Home Forums WPF controls Xceed DataGrid for WPF Multiple column configurations

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #25635 |

    I’d like an app to programmatically change the column layout of a grid based on a value in a ListBox. There are 2 things I don’t know:

    1) How do I store a bunch of XAML column configurations together? Seems like it would be something like this:
    <ResourceDictionary xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;
    <xcdg:DataGridControl.Columns x:Key=”ColumnConfig1″>
    <xcdg:Column FieldName=”Daterecved” Title=”Submitted” Width=”65″/>
    <xcdg:Column FieldName=”Rush” Title=”Rush” Width=”50″/>
    <xcdg:Column FieldName=”Package” Title=”Pkg” Width=”35″/>
    <xcdg:Column FieldName=”Totplnrord” Title=”Qty” Width=”65″/>

    Columns is not part of the type DataGridControl, so that doesn’t quite work.

    2) How do I change the column style of a grid with c# code? Can I do it without overriding the style for the entire grid?

    Imported from legacy forums. Posted by Brian (had 1902 views)

    Xceed Support
    Post count: 5658

    1) This feature is not available as expressed. We have no way currently to have Columns configurations as a “style” or “state” that can be saved and/or restored.

    The approach I have suggested in the past to configure multiple grids in the same way was to use a UserControl or a ContentPreseter/DataTemplate.

    Using any of the 2 approaches, you could have a single XAML pre-configuration applied on multiple DataGridControls.

    2) A Column in itself does not have a style, to style the cells that belongs to a particular column, you would have to create an implicit style for DataCell and place style triggers “ParentColumn.FieldName” to detect appropriate column.

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

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