<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" xmlns:Telerik_Windows_Controls_GridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView" xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input" xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	x:Class="_63584_FilteringWidth.MainPage"
	Width="640" Height="480" mc:Ignorable="d">

	<UserControl.Resources>
		<telerik:Office_BlackTheme x:Key="Theme"/>
		<Telerik_Windows_Controls_GridView:FilterOperatorConverter x:Key="FilterOperatorConverter"/>
		<DataTemplate x:Key="ActionTemplate">
			<TextBlock Text="{Binding Converter={StaticResource FilterOperatorConverter}}"/>
		</DataTemplate>
		<ControlTemplate x:Key="FilteringControlTemplate" TargetType="Telerik_Windows_Controls_GridView:FilteringControl">
			<Border Background="Red" BorderBrush="Green" CornerRadius="10" BorderThickness="1" Padding="5">
				<StackPanel MinWidth="200" MaxWidth="400">
					<Button x:Name="PART_ClearFilterButton" Margin="0,2,0,2" telerik:LocalizationManager.ResourceKey="GridViewClearFilter" telerik:StyleManager.Theme="{StaticResource Theme}"/>
					<StackPanel x:Name="PART_DistinctFilter" Visibility="{TemplateBinding DistinctFiltersVisibility}">
						<CheckBox x:Name="PART_SelectAllCheckBox" Margin="0,2,0,2" IsChecked="{Binding SelectAll, Mode=TwoWay}" telerik:LocalizationManager.ResourceKey="GridViewFilterSelectAll" telerik:StyleManager.Theme="{StaticResource Theme}"/>
						<ListBox x:Name="PART_DistinctValuesList" MaxHeight="250" ScrollViewer.HorizontalScrollBarVisibility="Auto" ItemsSource="{Binding DistinctValues}" SelectionMode="Multiple" telerik:StyleManager.Theme="{StaticResource Theme}">
							<ListBox.ItemsPanel>
								<ItemsPanelTemplate>
									<VirtualizingStackPanel/>
								</ItemsPanelTemplate>
							</ListBox.ItemsPanel>
							<ListBox.ItemTemplate>
								<DataTemplate>
									<CheckBox VerticalContentAlignment="Center" Content="{Binding ConvertedValue}" IsChecked="{Binding IsActive, Mode=TwoWay}" telerik:StyleManager.Theme="{StaticResource Theme}"/>
								</DataTemplate>
							</ListBox.ItemTemplate>
						</ListBox>
					</StackPanel>
					<StackPanel Margin="0,2,0,2">
						<TextBlock Margin="0,2,0,0" telerik:LocalizationManager.ResourceKey="GridViewFilterShowRowsWithValueThat"/>
						<telerikInput:RadComboBox x:Name="PART_Filter1ComboBox" Margin="0,2,0,2" ItemTemplate="{StaticResource ActionTemplate}" ItemsSource="{Binding AvailableActions}" SelectedItem="{Binding Filter1.Operator, Mode=TwoWay}" telerik:StyleManager.Theme="{StaticResource Theme}"/>
						<TextBox x:Name="PART_Filter1TextBox" Height="21" Margin="0,2,0,2" Text="{Binding Filter1.Value, Mode=TwoWay}" telerik:StyleManager.Theme="{StaticResource Theme}"/>
						<TextBlock Margin="0,2,0,0" telerik:LocalizationManager.ResourceKey="GridViewFilterAnd"/>
						<telerikInput:RadComboBox x:Name="PART_Filter2ComboBox" Margin="0,2,0,2" ItemTemplate="{StaticResource ActionTemplate}" ItemsSource="{Binding AvailableActions}" SelectedItem="{Binding Filter2.Operator, Mode=TwoWay}" telerik:StyleManager.Theme="{StaticResource Theme}"/>
						<TextBox x:Name="PART_Filter2TextBox" Height="21" Margin="0,2,0,2" Text="{Binding Filter2.Value, Mode=TwoWay}" telerik:StyleManager.Theme="{StaticResource Theme}"/>
					</StackPanel>
					<Button x:Name="PART_ApplyFilterButton" telerik:LocalizationManager.ResourceKey="GridViewFilter" telerik:StyleManager.Theme="{StaticResource Theme}"/>
				</StackPanel>
			</Border>
		</ControlTemplate>
		<Style x:Key="FilteringControlStyle" TargetType="Telerik_Windows_Controls_GridView:FilteringControl">
			<Setter Property="Template" Value="{StaticResource FilteringControlTemplate}"/>
		</Style>
		<LinearGradientBrush x:Key="GridViewIndicatorsPartsFill" EndPoint="0.5,1" StartPoint="0.5,0">
			<GradientStop Color="#FF000000" Offset="0"/>
			<GradientStop Color="#FF000000" Offset="1"/>
		</LinearGradientBrush>
		<SolidColorBrush x:Key="DistinctFilterActiveFunnelFill" Color="#FFFADCA5"/>
		<SolidColorBrush x:Key="DistinctFilterFunnelFill" Color="#FF535353"/>
		<ControlTemplate x:Key="DistinctFilterControlTemplate" TargetType="Telerik_Windows_Controls_GridView:FilteringDropDown">
			<Grid>
				<ToggleButton x:Name="PART_DropDownButton" Height="20" Width="20">
					<ToggleButton.Template>
						<ControlTemplate TargetType="ToggleButton">
							<ContentPresenter/>
						</ControlTemplate>
					</ToggleButton.Template>
					<Grid Height="12" Width="11" Background="Transparent">
						<Path Fill="{StaticResource GridViewIndicatorsPartsFill}" Stretch="Fill" Height="12" Width="11" Data="M0,0 L11,0 11,1 10,1 10,2 9,2 9,3 8,3 8,3.9999999 7,3.9999999 7,12 4,12 4,3.9999999 3.0000001,3.9999999 3.0000001,3 2,3 2,2 1,2 1,1 0,1 z"/>
						<Grid Height="12" Width="11" Visibility="{TemplateBinding FunnelFillVisibility}">
							<Path Fill="{StaticResource DistinctFilterActiveFunnelFill}" Stretch="Fill" Height="3" Margin="3.016,1.016,2.984,0" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Data="M0,0 L1,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,0 z">
								<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>
							<Path Fill="{StaticResource DistinctFilterFunnelFill}" Stretch="Fill" Data="M2.9999999,0.99999994 L2.9999999,2 3.9999999,2 3.9999999,3 4.9999999,3 4.9999999,4 5.9999999,4 5.9999999,3 6.9999999,3 6.9999999,2 7.9999999,2 7.9999999,0.99999994 6.9999999,0.99999994 5.9999999,0.99999994 4.9999999,0.99999994 3.9999999,0.99999994 z M0,0 L11,0 11,0.99999994 9.9999999,0.99999994 9.9999999,2 8.9999999,2 8.9999999,3 7.9999999,3 7.9999999,4 6.9999999,4 6.9999999,12 3.9999999,12 3.9999999,4 2.9999999,4 2.9999999,3 1.9999999,3 1.9999999,2 0.99999994,2 0.99999994,0.99999994 0,0.99999994 z"/>
						</Grid>
					</Grid>
				</ToggleButton>
				<Popup x:Name="PART_DropDownPopup"/>
			</Grid>
		</ControlTemplate>
		<SolidColorBrush x:Key="GridViewForeground" Color="#FF000000"/>
		<Style x:Key="FilteringDropDownStyle" TargetType="Telerik_Windows_Controls_GridView:FilteringDropDown">
			<Setter Property="Template" Value="{StaticResource DistinctFilterControlTemplate}"/>
			<Setter Property="Foreground" Value="{StaticResource GridViewForeground}"/>
			<Setter Property="FontWeight" Value="Normal"/>
		</Style>
	</UserControl.Resources>

	<Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource SampleDataSource}}">
		
		<telerikGridView:RadGridView Margin="0" ItemsSource="{Binding Collection}" d:LayoutOverrides="Width, Height">
			<telerikGridView:RadGridView.Columns>
				<telerikGridView:GridViewDataColumn DataMemberBinding="{Binding Property1}">
					<telerikGridView:GridViewDataColumn.FilteringControl>
						<Telerik_Windows_Controls_GridView:FilteringControl x:Name="myFilter" Style="{StaticResource FilteringControlStyle}" />
					</telerikGridView:GridViewDataColumn.FilteringControl>
				</telerikGridView:GridViewDataColumn>
			</telerikGridView:RadGridView.Columns>
		</telerikGridView:RadGridView>
		
	</Grid>
</UserControl>