Current filter:
                                You should refresh the page.
                                  • Hello!

                                    In a ResourceDictionary, I configure TableView not to show the group panel.

                                    Then I derive from GridControl (named EntityGridControl) and configure its TableView to show the group panel.

                                    How can I then have an instance of EntityGridControl where the group panel is hidden?

                                    The following approach does not work:

                                    <dxApplication11:EntityGridControl ItemsSource="{Binding Persons}" AutoGenerateColumns="AddNew" Grid.Row="1"> <dxApplication11:EntityGridControl.Resources> <Style TargetType="dxg:TableView" BasedOn="{StaticResource {x:Type dxg:TableView}}"> <Setter Property="ShowGroupPanel" Value="False" /> </Style> </dxApplication11:EntityGridControl.Resources> </dxApplication11:EntityGridControl>

                                    Please see the attached sample.


                                • Alexey Z (DevExpress Support) 12.31.2019

                                  Hello Markus,

                                  Thank you for the application. I was able to reproduce this behavior on my side. You can also reproduce this behavior using a standard WPF control, for instance, Button. The key point is to directly specify one of its properties in xaml and then specify the same property in an implicit style in its resources as follows:

                                  <Button Content="Click" Background="Red"> <Button.Resources> <Style TargetType="Button"> <Setter Property="Background" Value="Green"/> </Style> </Button.Resources> </Button>

                                  You can see that the button still has the red background.

                                  As for our TableView, would you please explain why it is necessary to set the ShowGroupPanel property to True? This property is True by default. However, if it is required for your task, please describe it in detail. This information will help us find a suitable solution quickly.

                                • Markus Nißl 12.31.2019

                                  Hello Alexey!

                                  Yes, ShowGroupPanel is by default set to true. As I don't want that, I set it to false in my ResourceDictionary.

                                  Then again, for my EntityGridControl, I generally do want to show it, hence I enabled it in EntityGridControl.xaml.

                                  But how can I now turn it off again for a specific instance?

                                1 Solution

                                Creation Date Importance Sort by

                                Hi Markus,
                                Local setters always have priority over style setters. You can learn more about this WPF specificity in the following help topic: Dependency Property Value Precedence. Although the issue you described is not directly related to our controls I would like to recommend the following solution:

                                1. Remove the local property setter.
                                2. Create an implicit style for the EntityGridControl element and define all TableView settings in it in the following manner:
                                <Style TargetType="local:EntityGridControl"> <Style.Resources> <Style TargetType="dxg:TableView"> <Setter Property="ShowGroupPanel" Value="True"/> </Style> </Style.Resources> </Style>
                                3. Use local a style to override implicit style settings:
                                <dxApplication11:EntityGridControl.Resources> <Style TargetType="dxg:TableView"> <Setter Property="ShowGroupPanel" Value="False" /> </Style> </dxApplication11:EntityGridControl.Resources>

                                Please note that you don't need to specify the BasedOn property in your styles. All styles are automatically inherited from the corresponding default style.


                                Show all comments
                                • Markus Nißl 01.01.2020

                                  Hello Alexander!

                                  Thank you very much for the link and your solution -- this does the trick!

                                  Regarding BasedOn: if you have an implicit style defined and you would like another style to be based on this implicit style, then BasedOn is necessary. Otherwise the new style is based on the default style.

                                  I had to do this also with your solution to preserve the other properties of my implicit style:

                                  <dxApplication11:EntityGridControl.Resources> <Style TargetType="dxg:TableView" BasedOn="{StaticResource {x:Type dxg:TableView}}"> <Setter Property="ShowGroupPanel" Value="False" /> </Style> </dxApplication11:EntityGridControl.Resources>

                                  Otherwise, my implicit style for TableView would have been ignored.


                                • Alexander Rus (DevExpress Support) 01.02.2020

                                  Thank you for informing us of your progress, Markus. I am happy to hear that the issue has been resolved.

                                • Markus Nißl 01.09.2020

                                  Hello Alexander!

                                  While your solution works for the scenario given above, it does not work for this:

                                  The same as above: always show the GroupPanel for EntityGridControl unless turned off via the style.

                                  Now I say all EntityGridControl shall also show the AutoFilterRow:

                                  <Style TargetType="local:EntityGridControl"> <Style.Resources> <Style TargetType="dxg:TableView"> <Setter Property="ShowGroupPanel" Value="True" /> <Setter Property="ShowAutoFilterRow" Value="True" /> </Style> </Style.Resources> </Style>

                                  When I want the GroupPanel hidden for one instance of EntityGridControl, AutoFilterRow is hidden too:

                                  <dxApplication11:EntityGridControl ItemsSource="{Binding Persons}"> <dxApplication11:EntityGridControl.Resources> <Style TargetType="dxg:TableView"> <Setter Property="ShowGroupPanel" Value="False" /> </Style> </dxApplication11:EntityGridControl.Resources> </dxApplication11:EntityGridControl>

                                  Please see the attached sample.

                                  Is this a bug or what am I doing wrong?


                                • Kirill (DevExpress Support) 01.10.2020

                                  Hello Markus,
                                  This behavior occurs because the last implicit style for a control completely overwrites all previous implicit styles for the same control. So, your style in EntityGridControl's Resources completely overwrites the style defined in the "Style.Resources" section.
                                  If you want to be able to overwrite only particular properties, create a base style for the implicit style and move all the required declarations to this base style:

                                  <Style TargetType="dxg:TableView" x:Key="baseTableViewStyle"> <Setter Property="ShowGroupPanel" Value="True" /> <Setter Property="ShowAutoFilterRow" Value="True" /> </Style> <Style TargetType="local:EntityGridControl"> <Style.Resources> <Style TargetType="dxg:TableView" BasedOn="{StaticResource baseTableViewStyle}"/> </Style.Resources> </Style>

                                  Inherit all your implicit styles from this base style and override particular properties there:

                                  <dxApplication11:EntityGridControl ItemsSource="{Binding Persons}" AutoGenerateColumns="AddNew" Grid.Row="1"> <dxApplication11:EntityGridControl.Resources> <Style TargetType="dxg:TableView" BasedOn="{StaticResource baseTableViewStyle}"> <Setter Property="ShowGroupPanel" Value="False" /> </Style> </dxApplication11:EntityGridControl.Resources> </dxApplication11:EntityGridControl>

                                  I've modified your sample project to demonstrate the main idea of this approach.


                                • Markus Nißl 01.10.2020

                                  Hello Kiril!

                                  Thanks for your explanation! WPF is mighty ... but in some regard also not that mighty!

                                  As I already have a GridControl descendant (EntityGridControl), I came up with another approach: I defined two dependency properties in EntityGridControl: ShowGroupPanel and ShowAutoFilterRow.

                                  In EntityGridControl.xaml I perform the following bindings:

                                  <dxg:GridControl x:Class="PDM.Maintenance.UI.Core.EntityGridControl" ...> <dxg:GridControl.View> <dxg:TableView ShowGroupPanel="{DXBinding '@s.Grid.ShowGroupPanel'}" ShowAutoFilterRow="{DXBinding '@s.Grid.ShowAutoFilterRow'}">

                                  Which allows me to easily adjust these setting per EntityGridControl instance:

                                  <core:EntityGridControl ItemsSource="..." ShowGroupPanel="False" ShowAutoFilterRow="False">

                                  Alas this doesn't work when EntityGridControl is used inside DataControlDetailDescriptor: "The Auto-Filter Row feature is not supported by detail grids."

                                  I tried two approaches:

                                  <core:EntityGridControl ShowAutoFilterRow="False">
                                  public EntityGridControl(IDataControlOriginationElement dataControlOriginationElement) : base(dataControlOriginationElement) { ShowAutoFilterRow = false; }

                                  None of them worked.

                                  Do you have a solution for this?

                                • Kirill (DevExpress Support) 01.13.2020

                                  Hello Markus,
                                  I was able to reproduce the same exception only if a detail TableView's ShowAutoFilterRow property wasn't disabled explicitly:

                                  <dxApplication11:EntityGridControl ItemsSource="{Binding Persons}" AutoGenerateColumns="AddNew" ShowAutoFilterRow="False" Grid.Row="1"> <dxApplication11:EntityGridControl.DetailDescriptor> <dxg:DataControlDetailDescriptor ItemsSourceBinding="{Binding Path=Persons}"> <dxg:DataControlDetailDescriptor.DataControl> <dxg:GridControl> <dxg:GridControl.View> <dxg:TableView/> </dxg:GridControl.View> </dxg:GridControl> <!--<dxApplication11:EntityGridControl/>--> </dxg:DataControlDetailDescriptor.DataControl> </dxg:DataControlDetailDescriptor> </dxApplication11:EntityGridControl.DetailDescriptor> </dxApplication11:EntityGridControl>

                                  If I explicitly disable it or use the same EntityGridControl element for details, there is no such exception:

                                  <dxg:DataControlDetailDescriptor.DataControl> <dxg:GridControl> <dxg:GridControl.View> <dxg:TableView ShowAutoFilterRow="False"/> </dxg:GridControl.View> </dxg:GridControl> <!--<dxApplication11:EntityGridControl/>--> </dxg:DataControlDetailDescriptor.DataControl>
                                  <dxg:DataControlDetailDescriptor.DataControl> <dxApplication11:EntityGridControl/> </dxg:DataControlDetailDescriptor.DataControl>

                                  See the sample project I attached for details. So, please make sure that you disable the ShowAutoFilterRow property for your detail GridControl separately. If this doesn't help, please modify my sample project to demonstrate the issue.


                                • Markus Nißl 01.13.2020

                                  Hello Kirill,

                                  I defined my dependency property with a default value of True as I do want to have the AutoFilterRow enabled for regular instances:

                                  public static readonly DependencyProperty ShowAutoFilterRowProperty = DependencyProperty.Register( "ShowAutoFilterRow" , typeof(bool) , typeof(EntityGridControl) , new PropertyMetadata(true) );

                                  If you do the same in your sample, you'll also get the exception that I observe.

                                  How to work around that without having to set AutoFilterRow=True for regular instances?


                                • Kirill (DevExpress Support) 01.14.2020

                                  It seems that this behavior occurs because the standard binding mechanism isn't executed immediately when a control is created/loaded or a bound property is changed. As a result, GridControl starts creating details before the TableView element receives a new ShowAutoFilterRow property value.
                                  As a possible solution, don't use bindings to get/set the ShowAutoFilterRow property value:

                                  <dxg:GridControl.View> <dxg:TableView ShowGroupPanel="{DXBinding '@s.Grid.ShowGroupPanel'}"/> </dxg:GridControl.View>

                                  In your EntityGridControl class, subscribe to changes of your custom ShowAutoFilterRow property and set TableView's ShowAutoFilterRow property when EntityGridControl is loaded or when your custom property is changed:

                                  public static readonly DependencyProperty ShowAutoFilterRowProperty = DependencyProperty.Register("ShowAutoFilterRow", typeof(bool), typeof(EntityGridControl), new PropertyMetadata(true, new PropertyChangedCallback(OnChanged))); private static void OnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var view = ((GridControl)d).View as TableView; if (view != null) view.ShowAutoFilterRow = (bool)e.NewValue; } protected override void OnLoaded(object sender, RoutedEventArgs e) { base.OnLoaded(sender, e); var view = this.View as TableView; if (view != null) view.ShowAutoFilterRow = this.ShowAutoFilterRow; }

                                  I've modified the sample project to demonstrate this approach in action.


                                • Markus Nißl 01.14.2020

                                  Thanks Kirill,

                                  this is now working for me. Thanks for the great support! :-)

                                • Kirill (DevExpress Support) 01.15.2020

                                  You are welcome!