Home Forums WPF controls Xceed DataGrid for WPF column order when binding to an object via a Style

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

    I would like to use a style to bind a collection object and specify certian field names (that map back to properties) for each style.

    so if I have an object foo with three properties:

    Foo()
    public bool isSelected;
    public string title;
    public DateTime date;

    I would like to create a ControlTemplate to specify the order of the properties from the object for data binding to the WPF DataGrid.

    I have tried creating a style with the Property of Template of a DataRow and the value:
    <ControlTemplate TargetType=”{x:Type xceed:DataRow}”>
    <xceed:DataCell FieldName=”isSelected”/>
    <xceed:DataCell FieldName=”title”/>
    <xceed:DataCell FieldName=”date”/>
    </ControlTemplate>

    It told me that ControlTemplate could only have one item. I would like each one of them to have thier own column… not simply using a StackPanel in the cell

    thanks!

    Imported from legacy forums. Posted by Rob (had 1003 views)

    User (Old forums)
    Member
    Post count: 23064

    Let me restate my desire here:

    I would like to be able to specify which columns are visible in the grid so that I can change the appearance and content of the grid on the fly.

    I was hoping to use a Style with a ControlTemplate.

    thanks

    Imported from legacy forums. Posted by Rob (had 381 views)

    Xceed Support
    Member
    Post count: 5658

    Please refer to the <a href=”http://doc.xceedsoft.com/products/XceedWpfDataGrid/Xceed.Wpf.DataGrid~Xceed.Wpf.DataGrid.Column.html”>Documentation on the Xceed DataGrid for WPF on how to create and configure Columns in the DataGridControl </a>.

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

    User (Old forums)
    Member
    Post count: 23064

    great, is there a way to do this through a style, specifying a ControlTemplate?

    Imported from legacy forums. Posted by Rob (had 531 views)

    Xceed Support
    Member
    Post count: 5658

    No. Columns can be ordered according to their VisiblePosition properties or according to the order in which the DataGridItemProperty objects have been added to the DataGridCollectionView’s ItemProperties collection.

    Styles and ControlTemplates cannot be used.

    Imported from legacy forums. Posted by Jenny [Xceed] (had 4495 views)

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