Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1715
Header combo box in xamdatagrid header.
posted

hi,

    i have a xam data grid and i am adding field through code behind.there is a combo box in each column header(edited label presenter style).

how can i bind each column collection to its header combo box?..

my label presenter style is 

<Style x:Key="HeaderWithCombo" TargetType="{x:Type igDP:LabelPresenter}">
<Setter Property="Padding" Value="5,4,5,4" />
<Setter Property="Background" Value="White"/>
<Setter Property="LabelHighlight" Value="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelHighlight}}" />
<Setter Property="InnerBorderBrush" Value="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelInnerBorder}}" />
<Setter Property="OuterBorderBrush" Value="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelOuterBorder}}" />
<Setter Property="Foreground" Value="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelForeground}}"/>
<Setter Property="HorizontalContentAlignment"
Value="Left" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:LabelPresenter}">
<ControlTemplate.Resources>
<Storyboard x:Key="sbHighlightOff">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="highlight">
<SplineDoubleKeyFrame Value="0" KeyTime="00:00:00.25"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>

<Grid Background="White">
<Rectangle Stroke="{TemplateBinding OuterBorderBrush}" StrokeThickness="1" RadiusX="1.55015910897703" RadiusY="1.55015910897703"
Fill="Transparent" Margin="0,0,0,0" x:Name="lineOuter" Width="Auto" Height="Auto" />
<Rectangle Stroke="{TemplateBinding InnerBorderBrush}" StrokeThickness="1" RadiusX="0.550159108977027" RadiusY="0.550159108977027"
Fill="Transparent" Margin="1,1,1,1" x:Name="lineInner" Width="Auto" Height="Auto" />
<Grid Margin="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
x:Name="sortIndicatorAndLabel">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Column="0" >

<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">


<ContentPresenter HorizontalAlignment="Left" x:Name="LabelContent" Focusable="False" Content="{Binding Path=Content,
RelativeSource={RelativeSource TemplatedParent}}" ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" VerticalAlignment="Center"/>

<igWindows:SortIndicator
x:Name="SortIndicator"
SortStatus="{TemplateBinding SortStatus}"
Visibility="Collapsed"
VerticalAlignment="Center"
Width="Auto"
HorizontalAlignment="Right"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">

<Rectangle Width="1" Fill="Gray" Margin="2,2,0,2" ></Rectangle>

<ComboBox Style="{DynamicResource HeaderCombo}" HorizontalAlignment="Right" HorizontalContentAlignment="Right" Margin="1,0,0,0" Width="30" Background="Transparent" BorderBrush="{x:Null}">

<ComboBoxItem>Test -1</ComboBoxItem>
<ComboBoxItem>Test -1</ComboBoxItem>
<ComboBoxItem>Test -1</ComboBoxItem>
<ComboBoxItem>Test -1</ComboBoxItem>
<ComboBoxItem>Test -1</ComboBoxItem>
<ComboBoxItem>Test -1</ComboBoxItem>

</ComboBox>
</StackPanel>
</StackPanel>

</Grid>
</Grid>

<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding Path=Field.LabelTextAlignmentResolved, RelativeSource={RelativeSource Self}}" Value="Center">
<Setter Property="HorizontalAlignment" TargetName="sortIndicatorAndLabel" Value="Center"/>
</DataTrigger>
<!-- HighlightPrimary -->

<Trigger Property="HorizontalAlignment" Value="Center">
<Setter Property="VerticalAlignment" TargetName="SortIndicator" Value="Top"/>
<Setter Property="HorizontalAlignment" TargetName="SortIndicator" Value="Center"/>
<Setter Property="Margin" TargetName="SortIndicator" Value="0,5,0,0"/>
</Trigger>

<!-- Only animate highlight -->
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
</MultiTrigger.Conditions>
<MultiTrigger.EnterActions>
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
</MultiTrigger.ExitActions>
</MultiTrigger>

<Trigger Property="SortStatus" Value="Ascending">
<Setter TargetName="SortIndicator" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="SortStatus" Value="Descending">
<Setter TargetName="SortIndicator" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

thanks in advance....