<UserControl x:Class="FilteringByCustomTypeSilverlight.Page3"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerikGrid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls.GridView;assembly=Telerik.Windows.Controls.GridView"
    xmlns:internal="clr-namespace:FilteringByCustomTypeSilverlight"
	>
    <UserControl.Resources>
        <internal:ValueFormatter x:Key="ValueFormatter" />
        <internal:ColorFormatter x:Key="ColorFormatterBackground" DefaultBrush="{x:Null}">
            <internal:ColorFormatter.HighlightBrush>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFFBEBEB" Offset="0.045"/>
                    <GradientStop Color="#FFC7CE" Offset="1"/>
                </LinearGradientBrush>
            </internal:ColorFormatter.HighlightBrush>
        </internal:ColorFormatter>
        <internal:ColorFormatter x:Key="ColorFormatterBorderBrush" DefaultBrush="#B3B3B3" HighlightBrush="#FFFB5959" />
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <telerikGrid:RadGridView Name="GridView">
            <telerikGrid:RadGridView.Resources>
                <Style TargetType="telerikGridView:GridViewCell" x:Name="HighlightNegativeValueAndFormatValue">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="telerikGridView:GridViewCell">
                                <Border DataContext="{TemplateBinding Value}" 
                                        BorderThickness="{TemplateBinding BorderThickness}" 
                                        BorderBrush="{Binding Converter={StaticResource ColorFormatterBorderBrush}}" 
                                        Background="{Binding Converter={StaticResource ColorFormatterBackground}}">
                                    <StackPanel Orientation="Horizontal" Margin="5,0,5,0" HorizontalAlignment="Right" VerticalAlignment="Center">
                                        <ContentPresenter Content="{Binding}" />
                                    </StackPanel>
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="BorderThickness" Value="0,0,1,1"/>
                </Style>
            </telerikGrid:RadGridView.Resources>
            <telerikGrid:RadGridView.Columns>
                <telerikGrid:GridViewDataColumn HeaderText="XAML Column" DataMemberBinding="{Binding Number}" />
                <!-- Why must i put IsCustomSortingEnabled="True" ? -->
                <!-- Why in the filter does it only show the options 'Is equal to' and 'Is not equal to', what about 'Is less then', etc.  It doesn't seem to think it's a numerical value.  -->
                <telerikGrid:GridViewDataColumn HeaderText="XAML Column 2" DataMemberBinding="{Binding Path=SalesDollars.ValueAsDouble, Converter={StaticResource ValueFormatter}}" CellStyle="{StaticResource HighlightNegativeValueAndFormatValue}" />
            </telerikGrid:RadGridView.Columns>
        </telerikGrid:RadGridView>
    </Grid>
</UserControl>
