I'm using an xceed datagrid with the Office2007BlackTheme. I also have a lot of styles, that I want to apply to UI controls inside my datagrid. Unfortunately the theme seems to override everything as long as its inside the datagrid.
It is worth noting that datagrid-related styles like "ColumnManagerCell" or "DataRow" still work as expected.
For example: I want to use my own style for the scrollbars, but even though the style is set to be applied globally; <Style TargetType="{x:Type ScrollBar}">
, it is still overridden in the datagrid. Outside of the grid it is not.
I realize that this is because, by default, the theme is set implicitly, but there doesn't seem to be anyway of setting it explicitly.
Is there a way to explicitly set the ScrollBar style (& others) after applying the theme? Maybe there's a way to base the tableflowview on the theme so it doesn't override other styles? I've looked around and did not find any solution.
I'm using Xceed DataGrid for WPF 6.3 with ThemePack 1-5. (Only DataGrid: xceed.com/xceed-datagrid-for-wpf paid version)
Any help is appreciated.
Here's my code for the DataGrid:
<xcdg:DataGridControl x:Name="datagrid"
ItemsSource="{Binding Source={StaticResource Features}}"
KeyUp="DatagridKeyUp"
AllowDetailToggle="True"
Margin="10"
NavigationBehavior="RowOrCell"
CellEditorDisplayConditions="RowIsBeingEdited,
MouseOverCell, MouseOverRow, RowIsCurrent, CellIsCurrent"
EditTriggers="BeginEditCommand, ClickOnCurrentCell,
SingleClick, CellIsCurrent, ActivationGesture, RowIsCurrent"
ItemScrollingBehavior="Immediate"
AutoCreateColumns="False">
<xcdg:DataGridControl.View>
<xcdg:TableflowView>
<!--Remove ugly header-->
<xcdg:TableflowView.FixedHeaders>
<DataTemplate>
<xcdg:ColumnManagerRow />
</DataTemplate>
</xcdg:TableflowView.FixedHeaders>
<!-- THEME IS SET HERE! -->
<xcdg:TableflowView.Theme>
<xcdg:Office2007BlackTheme/>
</xcdg:TableflowView.Theme>
</xcdg:TableflowView>
</xcdg:DataGridControl.View>
<xcdg:DataGridControl.Resources>
<Style TargetType="xcdg:TableViewScrollViewer">
<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
</Style>
</xcdg:DataGridControl.Resources>
<xcdg:DataGridControl.Columns>
<xcdg:Column FieldName="FeatureID" Title="FeatureID" ReadOnly="True"/>
<xcdg:Column FieldName="Name" Title="Feature name" ReadOnly="True" />
<xcdg:Column FieldName="Description" Title="Description" ReadOnly="True" />
<xcdg:UnboundColumn FieldName=" " />
</xcdg:DataGridControl.Columns>
<xcdg:DataGridControl.DetailConfigurations>
<xcdg:DetailConfiguration RelationName="Settings" UseDefaultHeadersFooters="False">
<xcdg:DetailConfiguration.Headers>
<DataTemplate>
<xcdg:ColumnManagerRow />
</DataTemplate>
</xcdg:DetailConfiguration.Headers>
<xcdg:DetailConfiguration.Columns>
<xcdg:Column FieldName="Name" Title="Name" ReadOnly="True" />
<xcdg:Column FieldName="Description" Title="Description" ReadOnly="True" />
<xcdg:Column FieldName="EditValues" Title="Edit Values" ReadOnly="True" />
<xcdg:Column FieldName="EditValueVar" Title="Edit Value" Width="150" ReadOnly="False"
CellContentTemplateSelector="{StaticResource SettingsDataTemplateSelector}"
DisplayMemberBinding="{Binding}" />
<xcdg:UnboundColumn FieldName=" " />
</xcdg:DetailConfiguration.Columns>
</xcdg:DetailConfiguration>
</xcdg:DataGridControl.DetailConfigurations>
</xcdg:DataGridControl>