Hi everybody,
I want to customize group header appearance defining a GroupConfiguration item in window resource and passing this item to "OrderID" column on OnApplyTemplate method . To do this I wrote this XAML:
<Window>
<Window.Resources>
<!--DataGridCollectionViewSource-->
<xceed:DataGridCollectionViewSource x:Key="cvs_orders"
Source="{Binding Source={x:Static Application.Current}, Path=Orders}" />
<!-- GroupConfiguration -->
<xceed:GroupConfiguration x:Key="orderIDGroupConfiguration"
UseDefaultHeadersFooters="False">
<xceed:GroupConfiguration.Headers>
<xceed:GroupHeaderFooterItemTemplate VisibleWhenCollapsed="True">
<DataTemplate>
<xceed:GroupHeaderControl>
<xceed:GroupHeaderControl.Resources>
<DataTemplate DataType="{x:Type xceed:Group}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="TEXT" Background="Yellow" />
</StackPanel>
</DataTemplate>
</xceed:GroupHeaderControl.Resources>
</xceed:GroupHeaderControl>
</DataTemplate>
</xceed:GroupHeaderFooterItemTemplate>
</xceed:GroupConfiguration.Headers>
</xceed:GroupConfiguration>
</Window.Resources>
<!-Xceed DataGrid Instance -->
<xceed:DataGridControl x:Name="OrdersGrid" mItemsSource="{Binding Source={StaticResource cvs_orders}}">
</xceed:DataGridControl>
</Window>
And in code behind a managed the OnApplyTemplate this way:
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
this.OrdersGrid.Columns["OrderID"].GroupConfiguration =
FindResource( "orderIDGroupConfiguration" ) as GroupConfiguration;
}
Running this code, ONLY the first group header contains the yellow textblock with "TEST" text inside, but all the other group headers use the default template.
If I move the Groupconfiguration Item from resources to <window> main tag and directly initialize the GroupConfiguration item of OrderId column, all works perfectly...
The problem is that I need to put groupconfigurations outside the main tag....
Please help me sson because i'm blocked here from two days.....