I have defined ComboBoxes for filtering in the grid header style (see XAML below).
How can I access the ComboBoxes from code?
a)
I do not understand how to loop through the grids columns an access the ComboBox in each columns header.
b)
I the ComboBoxes SelectionChanged event I do not understand how to determine the grid column of the ComboBox raising the event.
How can I access the ComboBoxes from code?
a)
I do not understand how to loop through the grids columns an access the ComboBox in each columns header.
b)
I the ComboBoxes SelectionChanged event I do not understand how to determine the grid column of the ComboBox raising the event.
<Style x:Key="GridViewHeaderCellFilterStyle" TargetType="{x:Type telerik:GridViewHeaderCell}"> |
<Setter Property="Template"> |
<Setter.Value> |
<ControlTemplate TargetType="{x:Type telerik:GridViewHeaderCell}"> |
<Grid x:Name="PART_HeaderCellGrid"> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="*"/> |
<ColumnDefinition Width="Auto"/> |
</Grid.ColumnDefinitions> |
<!-- Modification Start--> |
<Grid.RowDefinitions> |
<RowDefinition Height="Auto" /> |
<RowDefinition Height="*" /> |
</Grid.RowDefinitions> |
<Grid Grid.Row="1" Grid.ColumnSpan="2" Height="20"> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="Auto"/> |
<ColumnDefinition Width="*"/> |
</Grid.ColumnDefinitions> |
<telerik:RadComboBox Grid.Column="0" x:Name="cboOperator" SelectionChanged="cboOperator_SelectionChanged" FontWeight="Normal"> |
<telerik:RadComboBoxItem Content="=" IsSelected="True"></telerik:RadComboBoxItem> |
<telerik:RadComboBoxItem Content="<"></telerik:RadComboBoxItem> |
<telerik:RadComboBoxItem Content="<="></telerik:RadComboBoxItem> |
<telerik:RadComboBoxItem Content=">"></telerik:RadComboBoxItem> |
<telerik:RadComboBoxItem Content=">="></telerik:RadComboBoxItem> |
<telerik:RadComboBoxItem Content="in"></telerik:RadComboBoxItem> |
<telerik:RadComboBoxItem Content="like"></telerik:RadComboBoxItem> |
</telerik:RadComboBox> |
<telerik:RadComboBox Grid.Column="1" x:Name="cboValue" HorizontalAlignment="Stretch" IsEditable="True" IsReadOnly="False" FontWeight="Normal"></telerik:RadComboBox> |
</Grid> |
<!-- Modification End --> |
<Border x:Name="GridViewHeaderCell" Grid.ColumnSpan="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> |
<Border Background="{TemplateBinding Background}" BorderBrush="#FF4B4B4B" BorderThickness="1"/> |
</Border> |
<Border x:Name="GridViewHeaderCell_Over" Opacity="0" Grid.ColumnSpan="2" BorderBrush="#FFFFC92B" BorderThickness="{TemplateBinding BorderThickness}"> |
<Border BorderBrush="White" BorderThickness="1"> |
<Border.Background> |
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> |
<GradientStop Color="#FFFFFBA3" Offset="1"/> |
<GradientStop Color="#FFFFFBDA" Offset="0"/> |
<GradientStop Color="#FFFFD25A" Offset="0.43"/> |
<GradientStop Color="#FFFEEBAE" Offset="0.42"/> |
</LinearGradientBrush> |
</Border.Background> |
</Border> |
</Border> |
<Border x:Name="GridViewHeaderCell_Selected" Opacity="0" Grid.ColumnSpan="2" BorderThickness="{TemplateBinding BorderThickness}"> |
<Border.BorderBrush> |
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> |
<GradientStop Color="#FF616161" Offset="0"/> |
<GradientStop Color="#FF989898" Offset="1"/> |
</LinearGradientBrush> |
</Border.BorderBrush> |
<Border BorderThickness="1"> |
<Border.Background> |
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> |
<GradientStop Color="#FFFFD74E" Offset="0.996"/> |
<GradientStop Color="#FFFFDCAB" Offset="0.17"/> |
<GradientStop Color="#FFFFB062" Offset="0.57"/> |
<GradientStop Color="#FFFFD18F" Offset="0.56"/> |
<GradientStop Color="#FFFFBA74"/> |
</LinearGradientBrush> |
</Border.Background> |
<Border.BorderBrush> |
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> |
<GradientStop Color="#FFB69A78"/> |
<GradientStop Color="#FFFFE17A" Offset="0.126"/> |
</LinearGradientBrush> |
</Border.BorderBrush> |
</Border> |
</Border> |
<ContentControl x:Name="ContentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Foreground="{TemplateBinding Foreground}" Grid.Column="0"/> |
<Path x:Name="PART_SortIndicator" Fill="Black" Stretch="Fill" HorizontalAlignment="Center" Margin="0,3,0,0" VerticalAlignment="Top" Width="5" Height="3" Opacity="0" RenderTransformOrigin="0.5,0.5" Grid.ColumnSpan="2" Data="M0,0L1,0 2,0 3,0 4,0 5,0 5,1 4,1 4,2 3,2 3,3 2,3 2,2 1,2 1,1 0,1 0,0z"> |
<Path.RenderTransform> |
<TransformGroup> |
<ScaleTransform ScaleX="1" ScaleY="-1"/> |
<SkewTransform AngleX="0" AngleY="0"/> |
<RotateTransform Angle="0"/> |
<TranslateTransform X="0" Y="0"/> |
</TransformGroup> |
</Path.RenderTransform> |
</Path> |
<!--<telerik:FilteringDropDown x:Name="PART_DistinctFilterControl" Margin="0,0,8,0" IsTabStop="False" Visibility="{TemplateBinding FilteringUIVisibility}" Grid.Column="1"> |
<telerik:StyleManager.Theme> |
<telerik:Office_BlackTheme/> |
</telerik:StyleManager.Theme> |
</telerik:FilteringDropDown>--> |
<Thumb x:Name="PART_LeftHeaderGripper" HorizontalAlignment="Left" Grid.ColumnSpan="2"> |
<Thumb.Style> |
<Style TargetType="{x:Type Thumb}"> |
<Setter Property="Width" Value="8"/> |
<Setter Property="Background" Value="Transparent"/> |
<Setter Property="BorderBrush" Value="Transparent"/> |
<Setter Property="BorderThickness" Value="0"/> |
<Setter Property="HorizontalContentAlignment" Value="Stretch"/> |
<Setter Property="VerticalContentAlignment" Value="Stretch"/> |
<Setter Property="Padding" Value="0"/> |
<Setter Property="Cursor" Value="SizeWE"/> |
<Setter Property="Template"> |
<Setter.Value> |
<ControlTemplate TargetType="{x:Type Thumb}"> |
<Border HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"/> |
</ControlTemplate> |
</Setter.Value> |
</Setter> |
</Style> |
</Thumb.Style> |
</Thumb> |
<Thumb x:Name="PART_RightHeaderGripper" HorizontalAlignment="Right" Grid.ColumnSpan="2"> |
<Thumb.Style> |
<Style TargetType="{x:Type Thumb}"> |
<Setter Property="Width" Value="8"/> |
<Setter Property="Background" Value="Transparent"/> |
<Setter Property="BorderBrush" Value="Transparent"/> |
<Setter Property="BorderThickness" Value="0"/> |
<Setter Property="HorizontalContentAlignment" Value="Stretch"/> |
<Setter Property="VerticalContentAlignment" Value="Stretch"/> |
<Setter Property="Padding" Value="0"/> |
<Setter Property="Cursor" Value="SizeWE"/> |
<Setter Property="Template"> |
<Setter.Value> |
<ControlTemplate TargetType="{x:Type Thumb}"> |
<Border HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}"/> |
</ControlTemplate> |
</Setter.Value> |
</Setter> |
</Style> |
</Thumb.Style> |
</Thumb> |
</Grid> |
<ControlTemplate.Triggers> |
<MultiTrigger> |
<MultiTrigger.EnterActions> |
<BeginStoryboard> |
<Storyboard> |
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="GridViewHeaderCell_Over" Storyboard.TargetProperty="Opacity"> |
<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/> |
</DoubleAnimationUsingKeyFrames> |
</Storyboard> |
</BeginStoryboard> |
</MultiTrigger.EnterActions> |
<MultiTrigger.ExitActions> |
<BeginStoryboard> |
<Storyboard> |
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="GridViewHeaderCell_Over" Storyboard.TargetProperty="Opacity"> |
<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/> |
</DoubleAnimationUsingKeyFrames> |
</Storyboard> |
</BeginStoryboard> |
</MultiTrigger.ExitActions> |
<MultiTrigger.Conditions> |
<Condition Property="IsMouseOver" Value="True"/> |
<Condition Property="SortingState" Value="None"/> |
</MultiTrigger.Conditions> |
<Setter Property="Foreground" Value="Black"/> |
</MultiTrigger> |
<Trigger Property="SortingState" Value="Ascending"> |
<Setter Property="Foreground" Value="Black"/> |
<Setter Property="Opacity" TargetName="PART_SortIndicator" Value="1"/> |
<Setter Property="LayoutTransform" TargetName="PART_SortIndicator"> |
<Setter.Value> |
<ScaleTransform ScaleX="1" ScaleY="1"/> |
</Setter.Value> |
</Setter> |
<Setter Property="Opacity" TargetName="GridViewHeaderCell_Selected" Value="1"/> |
</Trigger> |
<Trigger Property="SortingState" Value="Descending"> |
<Setter Property="Foreground" Value="Black"/> |
<Setter Property="Opacity" TargetName="PART_SortIndicator" Value="1"/> |
<Setter Property="LayoutTransform" TargetName="PART_SortIndicator"> |
<Setter.Value> |
<ScaleTransform ScaleX="1" ScaleY="-1"/> |
</Setter.Value> |
</Setter> |
<Setter Property="Opacity" TargetName="GridViewHeaderCell_Selected" Value="1"/> |
</Trigger> |
<Trigger Property="SortingState" Value="None"> |
<Setter Property="Opacity" TargetName="PART_SortIndicator" Value="0"/> |
</Trigger> |
</ControlTemplate.Triggers> |
</ControlTemplate> |
</Setter.Value> |
</Setter> |
<Setter Property="Background"> |
<Setter.Value> |
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> |
<GradientStop Color="#FF5B5B5B" Offset="1"/> |
<GradientStop Color="#FF868686"/> |
<GradientStop Color="#FF4F4F4F" Offset="0.42"/> |
<GradientStop Color="#FF0E0E0E" Offset="0.43"/> |
</LinearGradientBrush> |
</Setter.Value> |
</Setter> |
<Setter Property="BorderBrush" Value="#FF848484"/> |
<Setter Property="BorderThickness" Value="0,0,1,1"/> |
<Setter Property="VerticalContentAlignment" Value="Center"/> |
<Setter Property="HorizontalContentAlignment" Value="Stretch"/> |
<Setter Property="Padding" Value="5,0,3,0"/> |
<Setter Property="Foreground" Value="White"/> |
<Setter Property="DropMarkPen"> |
<Setter.Value> |
<Pen Brush="White" Thickness="2"/> |
</Setter.Value> |
</Setter> |
<Setter Property="SnapsToDevicePixels" Value="True"/> |
</Style> |