Welcome to the Xceed Community | Help
Community Search  
More Search Options

Set Background on xcdg:ColumnManagerCell when AutoFilter is applied

Sort Posts: Previous Next
  •  06-01-2012, 2:51 AM Post no. 32197

    Set Background on xcdg:ColumnManagerCell when AutoFilter is applied

    My users would like the background of the column header to change when an autofilter is applied.  I presume I need to do something similar to the following:

            <Style TargetType="{x:Type xcdg:ColumnManagerCell}">
                <Style.Triggers>
                    <Trigger Property="????" Value="????">
                        <Setter Property="Background" Value="{StaticResource HeaderBrushFiltered}"/>
                    </Trigger>
                </Style.Triggers>
            </Style>  

    I can't figure what to put in the trigger property.  I imagine I could use something like AutoFilterValues.Count = 0.  How do I link the ColumnManagerCell to the AutoFilter for the column? 

  •  06-03-2012, 9:55 PM Post no. 32206 in reply to 32197

    Re: Set Background on xcdg:ColumnManagerCell when AutoFilter is applied

    Hi Jason,

    The only way to achieve this type of scenario is to redo the ColumnManagerCell template. In the template, you could add a setter for the background color in the correct section (the MultiDataTrigger that is used to display the AutoFilter glyph when a filter is present on that column). Unfortunately, this is the only way. You can create a hack to change the background using a custom property, but that would require some logic. For best performance and cleanliness, I would suggest redoing the template of the ColumnManagerCell.

    The location of the templates can be found on your machine:

    C:\Program Files (x86)\Xceed\Xceed DataGrid for WPF Professional Edition v4.3\Themes

    In the xaml files, you can find the templates of the controls for those specific themes. If you are using a theme like Media Player 11, then you would need to purchase the Blueprint edition. Or else, you can simply look at the XAML files in the location I provided.


    Marc

    Developer in Technical Support
    Xceed - Multi-talented components - http://xceed.com
  •  06-06-2012, 7:11 PM Post no. 32215 in reply to 32206

    Re: Set Background on xcdg:ColumnManagerCell when AutoFilter is applied

    Thanks Marc,

    That worked beautifully.  Just added a setter for the Background to the existing multi-trigger.

    Jason 

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.