Home Forums WPF controls Xceed DataGrid for WPF How to set Vista Theme as default on all my DataGrids ?

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

    Hi!

    This is how I apply the vista theme to a DataGrid:

    <xcdg:DataGridControl>
    <xcdg:DataGridControl.View>
    <xcdg:TableView >
    <xcdg:TableView.Theme>
    <xcdg:AeroNormalColorTheme/>
    </xcdg:TableView.Theme>
    <xcdg:TableView.FixedHeaders>
    <xcdg:ClearHeadersFooters/>
    <DataTemplate>
    <xcdg:ColumnManagerRow/>
    </DataTemplate>
    </xcdg:TableView.FixedHeaders>
    </xcdg:TableView>
    </xcdg:DataGridControl.View>
    </xcdg:DataGridControl>

    In this example I do also remove the GroupBy Row.

    I tried to extract this to a default style, so that it applies to all my grids.

    <Style TargetType=”{x:Type xcdg:DataGridControl}”>
    <Setter Property=”View”>
    <Setter.Value>
    <xcdg:TableView >
    <xcdg:TableView.Theme>
    <xcdg:AeroNormalColorTheme/>
    </xcdg:TableView.Theme>
    <xcdg:TableView.FixedHeaders>
    <xcdg:ClearHeadersFooters/>
    <DataTemplate>
    <xcdg:ColumnManagerRow/>
    </DataTemplate>
    </xcdg:TableView.FixedHeaders>
    </xcdg:TableView>
    </Setter.Value>
    </Setter>
    </Style>

    But that does not work. I´m getting a compiler error:

    ‘Xceed.Wpf.DataGrid.Views.TableView’ is not a valid value for ‘Setter.Value’; values derived from Visual or ContentElement are not supported

    Any Ideas?
    I really don´t want to repeat the configuration on every DataGrid, since I do have a lot of them in my App…

    Thank you!

    Imported from legacy forums. Posted by Christian (had 2457 views)

    Xceed Support
    Member
    Post count: 5658

    Unfortunately, this is not possible. The only thing you could do is create an implicit style that targets TableView and sets the Theme property. For example:

    <code>
    <Style TargetType=”{x:Type xcdg:TableView}”>
    <Setter Property=”Theme”
    Value=”RoyaleNormalColorTheme” />
    </Style>
    </code>

    The headers and footers cannot be configured via a style.

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

    User (Old forums)
    Member
    Post count: 23064

    Hi Jenny!

    Thanks for your answer!

    It´s a pity… I did it now by subclassing the GridControl and remove the Header and Footer in the Constructor…
    I also added an “OnRowDoubleClick” Event… Really convenient 🙂

    Christian

    Imported from legacy forums. Posted by Christian (had 3660 views)

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