This project has moved and is read-only. For the latest updates, please go here.

Xceed Data Grid - ColumnHeaderStyle

Dec 21, 2012 at 11:41 AM

Hi,

is it possible to edit the ColumnHeaderStyle Property of the Xceed DataGrid in the CommunityEdition?

I used the regular WPF DataGrid Control und there I can set the ColumnHeaderStyle Property, where I've a filter control, to use filtering within the DataGrid control.

ColumnHeaderStyle="{StaticResource {ComponentResourceKey TypeInTargetAssembly={x:Type Filter:DataGridHeaderFilterControl}, ResourceId=DataGridHeaderFilterControlStyle}}" 

Kind regards

Kevin

Dec 21, 2012 at 1:51 PM

The "ColumnHeader" class is represented by the ColumnManagerCell class in the Xceed DataGrid.

Create an implicit style on this class:

Ex.

<xcdg:DataGridControl>

<xcdg:DataGridControl.Resources>

<Style TargetType="{x:Type xcdg:ColumnManagerCell}">

...

</Style>

</xcdg:DataGridControl.Resources>

</xcdg:DataGridControl>

Dec 21, 2012 at 1:55 PM

Thank you.

I'll try it.

Jan 2, 2013 at 11:52 AM
Edited Jan 2, 2013 at 11:53 AM

I've some problems regarding the style and the control template...

So, in my style for the ColumnManagerCell I've a setter for the Template-Property:

<Style x:Key="{ComponentResourceKey 
                   TypeInTargetAssembly={x:Type local:XceedGridHeaderFilterControl}, 
                   ResourceId=MyResId}"
           TargetType="{x:Type xcdg:ColumnManagerCell}">
<Setter Property="Template">
    <Setter.Value>
        <ControlTemplate TargetType="{x:Type xcdg:ColumnManagerCell}">
           <local:XceedGridColumnFilter Margin="1" Grid.Column="0" Grid.Row="0"
                                        AssignedDataGridColumn ="{Binding RelativeSource={RelativeSource AncestorType={x:Type xcdg:ColumnManagerCell}}, 
                                        Path=ParentColumn}"
           </local:XceedGridColumnFilter>
       </ControlTemplate>
    </Setter.Value>
</Setter>  
</Style>

In my code for the "FilterExtension" my "AssignedDataGridColumn" is always null. Is my binding wrong?

The "AssignedDataGridColumn" looks like that:

 

        public static readonly DependencyProperty AssignedDataGridColumnHeaderProperty =
            DependencyProperty.Register("AssignedDataGridColumnHeader", typeof(ColumnManagerCell), typeof(XceedGridColumnFilter));

        public ColumnBase AssignedDataGridColumn
        {
            get 
            { 
                return (ColumnBase)GetValue(AssignedDataGridColumnProperty); 
            }
            set 
            { 
                SetValue(AssignedDataGridColumnProperty, value); 
            }
        }

 

Maybe you can give me another hint.

Kind regards

Kevin

Jan 9, 2013 at 3:02 PM

Ok.

Now I've written my own control which is set as DataTemplate in the FixedHeader part of the DataGridControl. This will work for me.