0

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>
Hjalte Tagmose
  • 67
  • 1
  • 12
  • Are you using Xceed **Plus Edition** or **Business Suite**? In case you are, I'm considering submitting a request for specific tags for these versions, because I currently don't see any. My VS 2017 does not recognize some of the properties you're using, so that's why I'm asking. Let me know, thanks. – jsanalytics Sep 28 '17 at 01:08
  • I'm using this one: https://xceed.com/xceed-datagrid-for-wpf/ – Hjalte Tagmose Sep 28 '17 at 12:14
  • Ok, so you're using a paid version, right? Although it looks like the `DataGrid` only and not the entire toolkit, as shown [HERE](https://github.com/xceedsoftware/wpftoolkit/wiki/Xceed-Toolkit-Plus-for-WPF). Again, I'm just asking because I would like proper tags for the versions I mentioned before, but if you have the DataGrid only... then I'm not sure a new tag would make sense. – jsanalytics Sep 28 '17 at 12:58
  • Just to clarify: I would like to have tags like these: `xceed-plus-edition` and `xceed-business-suite`. But it would make sense only if you're using the whole package and not only the `DataGrid`. The new tags would be justified because some of the properties in your XAML are not recognized by people like myself, using the free community version. – jsanalytics Sep 28 '17 at 13:10
  • Yeah, I'm only using the DataGrid (paid). I guess I should've clarified that, heh. – Hjalte Tagmose Sep 29 '17 at 06:53
  • Ok, thanks for the info. If you ever migrate to the full toolkit, please let me know and I'll suggest the new tags. – jsanalytics Sep 29 '17 at 09:27

0 Answers0