TemplateBinding "Foreground" doesn't work - templatebinding

I have a listbox the item template of which is a listbox. I am trying to set the "Foreground" property of the internal listbox to be the same as that of the main listbox. This is failing. Following is the code snippet. In here Foreground="{TemplateBinding Foreground}" has no effect.
<ListBox x:Name="GroupListBox" Grid.Column="1" Grid.Row="1" Style="{StaticResource ListBoxStyle1}" Visibility="Collapsed"
BorderBrush="Transparent" Background="Transparent" Foreground="{Binding WebForeground}">
<ListBox.ItemTemplate>
<DataTemplate x:Name="test">
<StackPanel Orientation="Horizontal" >
<!--<TextBlock Text="{Binding Rank}" FontFamily="Arial" FontSize="13" TextDecorations="Underline" TextWrapping="Wrap" Width="115" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,15,0,0"/>-->
<ListBox x:Name="SubGroupListBox" ItemsSource="{Binding InnerList }" ItemTemplate="{StaticResource ItemTemplateKey1}"
ItemsPanel="{StaticResource ItemsPanelKey}" Style="{StaticResource ListBoxStyle1}"
BorderBrush="Transparent" Background="Transparent" Foreground="{TemplateBinding Foreground}">
</ListBox>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

This example works for me - it may apply to what you are trying to do:
<ListBox x:Name="GroupListBox" Foreground="Purple">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<ListBox Foreground="{Binding Foreground, RelativeSource={RelativeSource Self}}">
<TextBox Text="{Binding Mode=OneWay}" FontSize="35" Foreground="{Binding Foreground, RelativeSource={RelativeSource Self}}" />
</ListBox>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsSource>
<x:Array Type="{x:Type sys:String}">
<sys:String>Sample Data</sys:String>
</x:Array>
</ListBox.ItemsSource>
</ListBox>

Related

WPF Listview Horizontal List

I am using listview in my WPF project. But the items are listed horizontally. I want it to be listed vertically and pass to the second column without a vertical scrollbar. How can I do that?
What I want to do:
My listview code:
<ListView Grid.Row="1" x:Name="listviewViews" HorizontalContentAlignment="Stretch" Visibility="Visible"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
SelectionMode="Single" PreviewMouseRightButtonDown="OnPreviewMouseRightButtonDown" SelectionChanged="listviewViews_SelectionChanged">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Height="{Binding (FrameworkElement.Height)}"
Width="{Binding (FrameworkElement.ActualWidth),
RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}"
ItemWidth="{Binding (ListView.View).ItemWidth,
RelativeSource={RelativeSource AncestorType=ListView}}"
MinWidth="{Binding ItemWidth, RelativeSource={RelativeSource Self}}"
ItemHeight="{Binding (ListView.View).ItemHeight,
RelativeSource={RelativeSource AncestorType=ListView}}" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Width="190">
<Grid HorizontalAlignment="Right" Margin="0 5" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="150"/>
<ColumnDefinition Width="35"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Grid.Column="0">
<TextBlock FontFamily="{StaticResource FontAwesome}" Margin="5 0" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsDisabled}" Value="True">
<Setter Property="Text" Value="" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock x:Name="txt" Text="{Binding ViewName}" VerticalAlignment="Center" Grid.Column="0"/>
</StackPanel>
<Button x:Name="btnViewDelete" ToolTip="{DynamicResource Delete}" Click="btnViewDelete_Click" Grid.Column="1">
<TextBlock HorizontalAlignment="Right" Text="" FontFamily="{StaticResource FontAwesome}" FontSize="12" VerticalAlignment="Center"/>
</Button>
</Grid>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Control this behavior via WrapPanel's Orientation property
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Vertical" ... />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
I edited the code as you said, but still one line remains below and vertical scrolling occurs:
Screenshot
Listview code:
<ListView Grid.Row="1" x:Name="listviewPools" HorizontalContentAlignment="Stretch"
ScrollViewer.VerticalScrollBarVisibility="Hidden">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Vertical"
Height="{Binding (FrameworkElement.ActualHeight)}"
Width="{Binding (FrameworkElement.Width),
RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}"
ItemWidth="{Binding (ListView.View).ItemWidth,
RelativeSource={RelativeSource AncestorType=ListView}}"
MinWidth="{Binding ItemWidth, RelativeSource={RelativeSource Self}}"
ItemHeight="{Binding (ListView.View).ItemHeight,
RelativeSource={RelativeSource AncestorType=ListView}}" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Right" Margin="0 5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="txt" Text="{Binding PoolName}" VerticalAlignment="Center" Grid.Column="0"/>
<Button x:Name="btnFilters" ToolTip="{DynamicResource Filters}" Click="btnFilters_Click" Grid.Column="1">
<TextBlock HorizontalAlignment="Right" Text="" FontFamily="{StaticResource FontAwesome}" FontSize="12" VerticalAlignment="Center"/>
</Button>
<Button x:Name="btnPoolEdit" ToolTip="{DynamicResource Edit}" Click="btnPoolEdit_Click" Grid.Column="2">
<TextBlock HorizontalAlignment="Right" Text="" FontFamily="{StaticResource FontAwesome}" FontSize="12" VerticalAlignment="Center"/>
</Button>
<Button x:Name="btnPoolDelete" ToolTip="{DynamicResource Delete}" Click="btnPoolDelete_Click" Grid.Column="3">
<TextBlock HorizontalAlignment="Right" Text="" FontFamily="{StaticResource FontAwesome}" FontSize="12" VerticalAlignment="Center"/>
</Button>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>

Wpf Dock Panel Dock left and Dock right

I am not able to move buttons inside of a dock panel to the right, I tried few solutions, and after all I put them in stack panels and tried to move them to the right, but acctualy they wont move anywhere, here is how it looks:
And here is my code:
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander IsExpanded="True" Background="Black" Opacity="0.7">
<Expander.Header>
<DockPanel Height="50">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" DockPanel.Dock="Right"> <Button DockPanel.Dock="Right" Content="Test" Margin="0,0,28,0"/></StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" DockPanel.Dock="Left"> <TextBlock FontWeight="Normal" FontFamily="Verdana" FontSize="20" Height="25" Foreground="#83D744" Text="{Binding Path=Name,StringFormat= Order Number:# {0}}" /></StackPanel>
</DockPanel>
</Expander.Header>
<Expander.Content>
<ItemsPresenter />
</Expander.Content>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>
edit:
This above causes width on dock panel
<DockPanel Height="50" Width="{Binding ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}">
<Button DockPanel.Dock="Right" Content="Test" Margin="0,0,28,0"/>
<TextBlock FontWeight="Normal" FontFamily="Verdana" FontSize="20" Height="25" Foreground="#83D744" Text="{Binding Path=Name,StringFormat= Order Number:# {0}}" />
</DockPanel>
Try the following method. this works in my project
<DockPanel Height="50">
<grid DockPanel.Dock="Right">
<Button Content="Test" Margin="0,0,28,0"/>
</grid >
<grid DockPanel.Dock="Left">
<TextBlock FontWeight="Normal" FontFamily="Verdana" FontSize="20" Height="25" Foreground="#83D744" Text="{Binding Path=Name,StringFormat= Order Number:# {0}}"/>
</grid>
</DockPanel>
Apply Width="{Binding ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" to your DockPanel and see if this solves your problem.

C#/WPF Allowing Line Breaks in Dynamically Generated Datagrid

I am building an application that uses a DataGrid. One column allows a user to input comments, and another contains description of the item. The problem is that I want the Comments section to comprise the bulk of the row, but the Description column is taking up a lot of horizontal space. There is ample vertical room, but it only displays in a single line. Is there a way to force it to break into multiple lines? Limiting the width just cuts off the data.
My XAML
<Window x:Class="hotels.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="700" Width="1000" Loaded="Window_Loaded" WindowStyle="ThreeDBorderWindow">
<Window.Resources>
<Style x:Key="Grouping" TargetType="{x:Type GroupItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Margin="10px" Foreground="White" Text="{Binding Name}" FontFamily="Arial Black" FontSize="18" Background="Blue">
</TextBlock>
<ItemsPresenter>
</ItemsPresenter>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<ScrollViewer>
<StackPanel Orientation="Vertical" Margin="20">
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="10, 0, 30, 0" VerticalAlignment="Center" >
<Label Content="Room:" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Center" />
<TextBox x:Name="roomTextBox" Margin="5,0,0,0" TextWrapping="Wrap" Width="50" Panel.ZIndex="-1" VerticalAlignment="Center"/>
<Label x:Name="locationLabel" Content="Location:" Margin="25,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<ComboBox x:Name="locationComboBox" SelectionChanged="filterEmployees" ItemsSource="{Binding}" Margin="5,0,0,0" SelectedIndex="-1" VerticalAlignment="Center" Width="150"/>
<Label x:Name="inspectLabel" Content="Inspector:" HorizontalAlignment="Left" Margin="50,0,0,0" VerticalAlignment="Center" Height="27"/>
<ComboBox x:Name="inspectorBox" ItemsSource="{Binding}" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Center" Width="100"/>
<Label x:Name="empLabel" Content="Attendant:" HorizontalAlignment="Left" Margin="50,0,0,0" VerticalAlignment="Center"/>
<ComboBox x:Name="employeeBox" ItemsSource="{Binding}" HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Center" Width="100"/>
</WrapPanel>
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="50, 0, 50, 0">
<Label x:Name="scoreLabel" Content="Score: " FontFamily="Arial Black" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center"></Label>
<Label x:Name="currentPointLabel" FontSize="24" Foreground="IndianRed" FontFamily="Arial Black" HorizontalAlignment="Center" VerticalAlignment="Center"></Label>
<Label FontSize="24" Foreground="ForestGreen" FontFamily="Arial Black" x:Name="totalPointLabel" HorizontalAlignment="Center" VerticalAlignment="Center"></Label>
</WrapPanel>
<DataGrid CanUserAddRows="False" CanUserDeleteRows="False" x:Name="itemGrid" Width="Auto" AutoGenerateColumns="False" ItemsSource="{Binding}" Margin="0,0,0,0" MinHeight="400" AlternatingRowBackground="LightSteelBlue" RowBackground="SteelBlue" CanUserResizeRows="False" CanUserSortColumns="False" CanUserReorderColumns="False" CanUserResizeColumns="False" FontFamily="Arial Black" VerticalContentAlignment="Center" VerticalAlignment="Center" >
<DataGrid.GroupStyle>
<GroupStyle ContainerStyle="{StaticResource Grouping}">
<GroupStyle.Panel>
<ItemsPanelTemplate>
<DataGridRowsPresenter></DataGridRowsPresenter>
</ItemsPanelTemplate>
</GroupStyle.Panel>
</GroupStyle>
</DataGrid.GroupStyle>
<DataGrid.Columns>
<DataGridTextColumn IsReadOnly="True" Width="auto" Header="Description" Binding="{Binding Description}" CanUserResize="False" />
<DataGridTextColumn IsReadOnly="True" Width="auto" Header="Points Possible" Binding="{Binding Points}" />
<DataGridTemplateColumn Header="Deductions" >
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox Height="40" VerticalAlignment="Center" HorizontalAlignment="Center" Width="Auto" ItemsSource="{Binding Score}" SelectedIndex="0" SelectionChanged="updateScore" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Score}" SelectedIndex="0" SelectionChanged="updateScore" Height="40" Width="Auto" />
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn IsReadOnly="True" Width="50" Header="Score" Binding="{Binding Current}" />
<DataGridTemplateColumn Header="Comments" MinWidth="100" Width="*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBox Text="{Binding Comments}" Margin="10" Width="Auto" Height="100" TextChanged="TextBox_TextChanged"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<TextBox Text="{Binding Comments, Mode=TwoWay}" Margin="10" Width="Auto" Height="100"></TextBox>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Button x:Name="submitButton" Click="submitData" Content="Submit" HorizontalAlignment="right" Margin="00, 0, 00, 00 " VerticalAlignment="Center" Width="75"/>
</StackPanel>
</ScrollViewer>
</Window>
and a screenshot so perhaps y'all can get a better idea of what I am meaning
Thanks!
You need add an ElementStyle to your DataGridTextColumn, and use it to set the TextWrapping Property:
<DataGridTextColumn IsReadOnly="True" Width="auto" Header="Description" Binding="{Binding Description}" CanUserResize="False" />
<DataGridTextColumn.ElementStyle>
<Style>
<Setter Property="TextBlock.TextWrapping" Value="Wrap" />
</Style>
</DataGridTextColumn.ElementStyle>
<DataGridTextColumn/>
You need to add TextWrapping="Wrap" to the comments textboxes.

Event trigger for entire listview item

I have
<ListView ScrollViewer.VerticalScrollBarVisibility="Auto" Grid.Row="1" Grid.Column="0" Margin="2" Name="CoursesListView" ItemsSource="{Binding CourseTags}">
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListView.ItemContainerStyle>
<ListView.ItemTemplate>
<DataTemplate>
<Border Margin="2" BorderThickness="1" BorderBrush="Red" Background="AntiqueWhite" CornerRadius="2" Cursor="Hand">
<WrapPanel ToolTip="{Binding Description}" HorizontalAlignment="Stretch">
<TextBlock Text="{Binding Name}" FontWeight="Bold" />
<TextBlock Text=" (" />
<TextBlock Text="{Binding NumberOfCourses}" TextDecorations="Underline" Foreground="Blue" />
<TextBlock Text=")" />
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding DataContext.ProductTagSelectedCommand, ElementName=LayoutRoot}"
CommandParameter="{Binding Name}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</WrapPanel>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
The items are stretched well and have the same width regardless how much text they have. Hand cursor displays correctly as well (wherever I point) The problem is that EventTrigger fires command only when I click on the text blocks. How to make it work throughout all the item?
It's very simple. Just place your EventTrigger inside the Border, not the WrapPanel:
<Border Margin="2" BorderThickness="1" BorderBrush="Red" Background="AntiqueWhite" CornerRadius="2" Cursor="Hand">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding DataContext.ProductTagSelectedCommand, ElementName=LayoutRoot}" CommandParameter="{Binding Name}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<WrapPanel ToolTip="{Binding Description}" HorizontalAlignment="Stretch">
<TextBlock Text="{Binding Name}" FontWeight="Bold" />
<TextBlock Text=" (" />
<TextBlock Text="{Binding NumberOfCourses}" TextDecorations="Underline" Foreground="Blue" />
<TextBlock Text=")" />
</WrapPanel>
</Border>

RadGridView Filtering Control Template

I defined a control template to replace the default template of the filtering control on the RadGridView. I am autogenerating columns, how do I apply this custom control template?
My Grid:
<telerik:RadGridView x:Name="dataGrid" telerik:StyleManager.Theme="Windows8Touch"
AutoGenerateColumns="True"
ColumnWidth="200"
ShowInsertRow="true"
GroupRenderMode="Flat"
ValidatesOnDataErrors="InEditMode"
AlternationCount="2"
RowHeight="50"
ItemsSource="{Binding Path=TemplateData, Mode=TwoWay}"
ShouldRefresh="{Binding Path=Refresh}"
IsReadOnlyBinding="{Binding IsReadOnly}"
CloseProgressWhenRendered="True"
ShowGroupPanel="False" CanUserSortColumns="False">
My template:
<ControlTemplate x:Key="FilteringControlTemplate" TargetType="telerik:FilteringControl">
<Border BorderThickness="{TemplateBinding BorderThickness}"
Margin="{TemplateBinding Margin}"
CornerRadius="1"
BorderBrush="{TemplateBinding BorderBrush}">
<Border BorderBrush="{StaticResource ControlInnerBorder}" BorderThickness="1" Background="{TemplateBinding Background}">
<StackPanel MinWidth="200" MaxWidth="350" Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
<TextBlock Foreground="Red" FontSize="18">Look, I am different ;)</TextBlock>
<StackPanel x:Name="PART_DistinctFilter" Visibility="{TemplateBinding DistinctFiltersVisibility}">
<CheckBox x:Name="PART_SelectAllCheckBox"
IsChecked="{Binding SelectAll, Mode=TwoWay}"
Margin="0,2"
telerik:LocalizationManager.ResourceKey="GridViewFilterSelectAll"
telerik:StyleManager.Theme="{StaticResource Theme}"/>
<ListBox x:Name="PART_DistinctValuesList"
ItemsSource="{Binding DistinctValues}"
telerik:StyleManager.Theme="{StaticResource Theme}"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
MaxHeight="250"
SelectionMode="Multiple">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsActive, Mode=TwoWay}"
Content="{Binding ConvertedValue}"
VerticalContentAlignment="Center"
telerik:StyleManager.Theme="{StaticResource Theme}"/>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem"
BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:Office_BlackTheme, ElementType=ListBoxItem}}"
>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
</StackPanel>
<StackPanel Margin="0,2">
<TextBlock telerik:LocalizationManager.ResourceKey="GridViewFilterShowRowsWithValueThat" Margin="0,2,0,0" />
<telerik:RadComboBox x:Name="PART_Filter1ComboBox"
Margin="0,2,0,2"
ItemTemplate="{StaticResource ActionTemplate}"
telerik:StyleManager.Theme="{StaticResource Theme}"
ItemsSource="{Binding AvailableActions}"
SelectedItem="{Binding Filter1.Operator, Mode=TwoWay}" />
<TextBox x:Name="PART_Filter1TextBox"
Text="{Binding Filter1.Value, Mode=TwoWay}"
VerticalContentAlignment="Center"
Margin="0,2" Padding="3,0"
telerik:StyleManager.Theme="{StaticResource Theme}"
Height="22" />
<CheckBox x:Name="PART_Filter1MatchCaseCheckBox"
IsChecked="{Binding Filter1.IsCaseSensitive, Mode=TwoWay}"
Visibility="{Binding MatchCaseVisibility}"
Margin="0,2"
telerik:LocalizationManager.ResourceKey="GridViewFilterMatchCase"
telerik:StyleManager.Theme="{StaticResource Theme}"/>
<telerik:RadComboBox x:Name="PART_LogicalOperatorsComboBox"
Margin="0,2"
telerik:StyleManager.Theme="{StaticResource Theme}"
ItemTemplate="{StaticResource LogicalOperatorTemplate}"
ItemsSource="{Binding LogicalOperators}"
SelectedItem="{Binding FieldFilterLogicalOperator, Mode=TwoWay}" />
<telerik:RadComboBox x:Name="PART_Filter2ComboBox"
Margin="0,2"
telerik:StyleManager.Theme="{StaticResource Theme}"
ItemTemplate="{StaticResource ActionTemplate}"
ItemsSource="{Binding AvailableActions}"
SelectedItem="{Binding Filter2.Operator, Mode=TwoWay}" />
<TextBox x:Name="PART_Filter2TextBox"
Text="{Binding Filter2.Value, Mode=TwoWay}"
VerticalContentAlignment="Center"
Margin="0,2" Padding="3,0"
telerik:StyleManager.Theme="{StaticResource Theme}"
Height="22" />
<CheckBox x:Name="PART_Filter2MatchCaseCheckBox"
IsChecked="{Binding Filter2.IsCaseSensitive, Mode=TwoWay}"
Visibility="{Binding MatchCaseVisibility}"
Margin="0,2"
telerik:LocalizationManager.ResourceKey="GridViewFilterMatchCase"
telerik:StyleManager.Theme="{StaticResource Theme}"/>
</StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button x:Name="PART_ApplyFilterButton" Grid.Column="0"
Margin="0,2,2,2" Height="22"
telerik:LocalizationManager.ResourceKey="GridViewFilter"
telerik:StyleManager.Theme="{StaticResource Theme}" />
<Button x:Name="PART_ClearFilterButton" Grid.Column="1"
Margin="2,2,0,2" Height="22"
telerik:LocalizationManager.ResourceKey="GridViewClearFilter"
telerik:StyleManager.Theme="{StaticResource Theme}" />
</Grid>
</StackPanel>
</Border>
</Border>
</ControlTemplate>
add a style, which automatically applies the template:
<Style TargetType="telerik:FilteringControl">
<Setter Property="Template" Value="{StaticResource FilteringControlTemplate}" />
</Style>
That way, you don't need to change anything in the visual tree.

Resources