This quick start will guide you through the steps of adding FlexGrid and FilterEditor controls to an application, binding FlexGrid to a data source and setting the properties of controls.
Complete the steps given below to see how the FilterEditor control appears after data binding and setting properties.
XAML |
Copy Code
|
---|---|
<Window x:Name="window" x:Class="QuickStart_FilterEditorControl.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" xmlns:c1df="clr-namespace:C1.DataFilter;assembly=C1.WPF.DataFilter.4.5.2" xmlns:local="clr-namespace:QuickStart_FilterEditorControl" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800" > <Grid Name="LayoutRoot"> <Grid.RowDefinitions> <RowDefinition Height="auto"/> <RowDefinition /> </Grid.RowDefinitions> <Grid Grid.Row="1"> <Grid.ColumnDefinitions> <ColumnDefinition Width="231*" /> <ColumnDefinition Width="36*"/> <ColumnDefinition Width="140*" /> <ColumnDefinition Width="393*"/> </Grid.ColumnDefinitions> <c1:C1FilterEditor x:Name="filterEditor" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"> </c1:C1FilterEditor> <c1:C1FlexGrid x:Name="flexGrid" Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="2"> </c1:C1FlexGrid> </Grid> </Grid> </Window> |
Add the following XAML code to populate the FlexGrid columns with data.
XAML |
Copy Code
|
---|---|
<c1:C1FlexGrid AutoGenerateColumns="False" x:Name="flexGrid" Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="2"> <c1:C1FlexGrid.Columns> <c1:Column Header="ID" Binding="{Binding ID}" /> <c1:Column Header="Name" Binding="{Binding Name}" /> <c1:Column Header="Country" Binding="{Binding Country}" /> <c1:Column Header="CountryID" Binding="{Binding CountryID}" /> <c1:Column Header="First" Binding="{Binding First}" /> <c1:Column Header="Last" Binding="{Binding Last}" /> <c1:Column Header="Weight" Binding="{Binding Weight}" /> </c1:C1FlexGrid.Columns> </c1:C1FlexGrid> |
XAML |
Copy Code
|
---|---|
<c1:C1FilterEditor x:Name="filterEditor" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"> <c1:C1FilterEditor.Expression> <c1df:CombinationExpression FilterCombination="Or"> <c1df:CombinationExpression.Expressions> <c1df:OperationExpression PropertyName="Name" FilterOperation="Contains" Value="a" /> <c1df:OperationExpression PropertyName="Country" FilterOperation="EndsWith" Value="r" /> <c1df:OperationExpression PropertyName="ID" FilterOperation="GreaterThan" Value="2" /> </c1df:CombinationExpression.Expressions> </c1df:CombinationExpression> </c1:C1FilterEditor.Expression> </c1:C1FilterEditor> |