<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
	x:Class="WpfApplication11.MainWindow"
	x:Name="Window"
	Title="MainWindow"
	Width="640" Height="480">
	<Window.Resources>
		<Style x:Key="FilteringControlStyle1" TargetType="{x:Type telerik:FilteringControl}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type telerik:FilteringControl}">
						<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1" Margin="{TemplateBinding Margin}">
							<Border BorderBrush="White" BorderThickness="1" Background="{TemplateBinding Background}">
								<StackPanel HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" MaxWidth="350" Margin="{TemplateBinding Padding}" MinWidth="200" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
									<StackPanel x:Name="PART_DistinctFilter" Visibility="{TemplateBinding DistinctFiltersVisibility}">
										<CheckBox x:Name="PART_SelectAllCheckBox" Content="Select All" IsChecked="{Binding SelectAll, Mode=TwoWay}" Margin="0,2" telerik:LocalizationManager.ResourceKey="GridViewFilterSelectAll">
											<telerik:StyleManager.Theme>
												<telerik:Office_BlackTheme/>
											</telerik:StyleManager.Theme>
										</CheckBox>
										<ListBox x:Name="PART_DistinctValuesList" ItemsSource="{Binding DistinctValues}" ScrollViewer.HorizontalScrollBarVisibility="Auto" Height="75" SelectionMode="Multiple">
											<ListBox.ItemTemplate>
												<DataTemplate>
													<CheckBox Content="{Binding ConvertedValue}" IsChecked="{Binding IsActive, Mode=TwoWay}" VerticalContentAlignment="Center">
														<telerik:StyleManager.Theme>
															<telerik:Office_BlackTheme/>
														</telerik:StyleManager.Theme>
													</CheckBox>
												</DataTemplate>
											</ListBox.ItemTemplate>
											<telerik:StyleManager.Theme>
												<telerik:Office_BlackTheme/>
											</telerik:StyleManager.Theme>
										</ListBox>
									</StackPanel>
									<StackPanel Margin="0,2" Visibility="{TemplateBinding FieldFiltersVisibility}">
										<TextBlock Margin="0,2,0,0" telerik:LocalizationManager.ResourceKey="GridViewFilterShowRowsWithValueThat" Text="Show rows with value that"><Run Text="Show rows with value that"/></TextBlock>
										<telerik:RadComboBox x:Name="PART_Filter1ComboBox" ItemsSource="{Binding AvailableActions}" SelectedItem="{Binding Filter2.Operator, Mode=TwoWay}" Margin="0,2">
											<telerik:RadComboBox.ItemTemplate>
												<DataTemplate>
													<TextBlock>
														<TextBlock.Text>
															<Binding>
																<Binding.Converter>
																	<telerik:FilterOperatorConverter/>
																</Binding.Converter>
															</Binding>
														</TextBlock.Text>
													</TextBlock>
												</DataTemplate>
											</telerik:RadComboBox.ItemTemplate>
											<telerik:StyleManager.Theme>
												<telerik:Office_BlackTheme/>
											</telerik:StyleManager.Theme>
										</telerik:RadComboBox>
										<ContentControl x:Name="PART_Filter1ContentControl" DataContext="{Binding Filter1}" HorizontalContentAlignment="Stretch" Margin="0,2" VerticalContentAlignment="Stretch"/>
										<telerik:RadComboBox x:Name="PART_LogicalOperatorsComboBox"  ItemsSource="{Binding LogicalOperators}" SelectedItem="{Binding FieldFilterLogicalOperator, Mode=TwoWay}" Margin="0,2">
											<telerik:RadComboBox.ItemTemplate>
												<DataTemplate>
													<TextBlock>
														<TextBlock.Text>
															<Binding>
																<Binding.Converter>
																	<telerik:FilterCompositionLogicalOperatorConverter/>
																</Binding.Converter>
															</Binding>
														</TextBlock.Text>
													</TextBlock>
												</DataTemplate>
											</telerik:RadComboBox.ItemTemplate>
											<telerik:StyleManager.Theme>
												<telerik:Office_BlackTheme/>
											</telerik:StyleManager.Theme>
										</telerik:RadComboBox>
										<telerik:RadComboBox x:Name="PART_Filter2ComboBox" ItemsSource="{Binding AvailableActions}" SelectedItem="{Binding Filter2.Operator, Mode=TwoWay}" Margin="0,2">
											<telerik:RadComboBox.ItemTemplate>
												<DataTemplate>
													<TextBlock>
														<TextBlock.Text>
															<Binding>
																<Binding.Converter>
																	<telerik:FilterOperatorConverter/>
																</Binding.Converter>
															</Binding>
														</TextBlock.Text>
													</TextBlock>
												</DataTemplate>
											</telerik:RadComboBox.ItemTemplate>
											<telerik:StyleManager.Theme>
												<telerik:Office_BlackTheme/>
											</telerik:StyleManager.Theme>
										</telerik:RadComboBox>
										<ContentControl x:Name="PART_Filter2ContentControl" DataContext="{Binding Filter2}" HorizontalContentAlignment="Stretch" Margin="0,2" VerticalContentAlignment="Stretch"/>
									</StackPanel>
									<Grid>
										<Grid.ColumnDefinitions>
											<ColumnDefinition/>
											<ColumnDefinition/>
										</Grid.ColumnDefinitions>
										<Button x:Name="PART_ApplyFilterButton" Content="Filter" Grid.Column="0" Height="22" Margin="0,2,2,2" telerik:LocalizationManager.ResourceKey="GridViewFilter">
											<telerik:StyleManager.Theme>
												<telerik:Office_BlackTheme/>
											</telerik:StyleManager.Theme>
										</Button>
										<Button x:Name="PART_ClearFilterButton" Content="Clear Filter" Grid.Column="1" Height="22" Margin="2,2,0,2" telerik:LocalizationManager.ResourceKey="GridViewClearFilter">
											<telerik:StyleManager.Theme>
												<telerik:Office_BlackTheme/>
											</telerik:StyleManager.Theme>
										</Button>
									</Grid>
								</StackPanel>
							</Border>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Setter Property="Background" Value="#FFE4E4E4"/>
			<Setter Property="BorderBrush" Value="#FF848484"/>
			<Setter Property="Padding" Value="5"/>
			<Setter Property="Margin" Value="0,2,0,0"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="VerticalContentAlignment" Value="Stretch"/>
			<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
			<Setter Property="Foreground" Value="Black"/>
			<Setter Property="SnapsToDevicePixels" Value="True"/>
		</Style>
	</Window.Resources>

	<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource SampleDataSource}}">
		<telerik:RadGridView Margin="191,8,8,147" ItemsSource="{Binding Collection}">
			<telerik:RadGridView.Columns>
				<telerik:GridViewDataColumn FilteringControlStyle="{StaticResource FilteringControlStyle1}" Header="P1" DataMemberBinding="{Binding Property1}"/>
					<telerik:GridViewDataColumn Header="P2" DataMemberBinding="{Binding Property2}"/>
						<telerik:GridViewDataColumn Header="P3" DataMemberBinding="{Binding Property3}"/>
							<telerik:GridViewDataColumn Header="P4" DataMemberBinding="{Binding Property4}"/>
				</telerik:RadGridView.Columns>
			</telerik:RadGridView>
		
	</Grid>
</Window>