Home Forums WPF controls Xceed DataGrid for WPF Bind column to function

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23173 |

    How do i bind a column to a function of an object?

    I have to do this at runtime, tryed this so far in C# but it did not work:

    DataGridControl grid = new DataGridControl();
    Xceed.Wpf.DataGrid.Column col1 = new Column();
    col1.FieldName = “Test.ToString()”;
    col1.Title = “To String Test”;
    gridColumns.Add(col1);

    Thx
    Silas

    Imported from legacy forums. Posted by Ralf (had 2394 views)

    Xceed Support
    Member
    Post count: 5658

    One way would be to specify the DisplayMemberBinding on the column… But in the DisplayMemberBinding, specify a converter (custom built) that would call the required function on the DataObject and return its result. You could even code your own “ConvertBack” routine, if you need an editable Column.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 177 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks Marcus!

    Imported from legacy forums. Posted by Ralf (had 3430 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.