<Window x:Class="WpfApplication1.MainWindow"
        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"
        xmlns:system="clr-namespace:System;assembly=mscorlib"
        xmlns:demo="clr-namespace:WpfApplication1"
        Title="MainWindow">
    <Window.DataContext>
        <demo:ExamplesDataContext />
    </Window.DataContext>

    <Grid x:Name="LayoutRoot">
        <Grid.Resources>
            <system:Double x:Key="BarRadiusX">0</system:Double>
            <system:Double x:Key="BarRadiusY">0</system:Double>
            <system:Double x:Key="BarMaskRadius">0</system:Double>

            <SolidColorBrush x:Key="BarMaskStroke" Color="Transparent" />
            <system:Double x:Key="BarMaskStrokeThickness">0</system:Double>
            <LinearGradientBrush x:Key="BarMaskBrush"  EndPoint="1,0.5" StartPoint="0,0.5">
                <GradientStop Color="#00FFFFFF"/>
                <GradientStop Color="#00FFFFFF" Offset="1"/>
                <GradientStop Color="#19FFFFFF" Offset="0.2"/>
                <GradientStop Color="#B2FFFFFF" Offset="0.2"/>
            </LinearGradientBrush>
            <SolidColorBrush x:Key="BarOpacityMaskBrush" Color="#FF000000" />
            <SolidColorBrush x:Key="BarTopMaskBrush" Color="Transparent" />

            <Style x:Key="ExportStyle" TargetType="telerik:Bar">
                <Setter Property="Template" >
                    <Setter.Value>
                        <ControlTemplate TargetType="telerik:Bar">
                            <Canvas Opacity="1"  x:Name="PART_MainContainer">
                                <Rectangle x:Name="PART_DefiningGeometry"                                    
                               Height="{TemplateBinding ItemActualHeight}"
                               Width="{TemplateBinding ItemActualWidth}"
                               Style="{TemplateBinding ItemStyle}"
                               RadiusX="{StaticResource BarRadiusX}"
                               RadiusY="{StaticResource BarRadiusY}" />
                                <Rectangle Height="{TemplateBinding ItemActualHeight}"
                               Width="{TemplateBinding ItemActualWidth}"
                               RadiusX="{StaticResource BarMaskRadius}"
                               RadiusY="{StaticResource BarMaskRadius}"
                               OpacityMask="{StaticResource BarOpacityMaskBrush}"
                               Fill="{StaticResource BarMaskBrush}"
                               Stroke="{StaticResource BarMaskStroke}"
                               StrokeThickness="{StaticResource BarMaskStrokeThickness}" />
                                <Rectangle x:Name="PART_SelectedState" 
                                   Height="{TemplateBinding ItemActualHeight}"
                                   Width="{TemplateBinding ItemActualWidth}"
                                   RadiusX="{StaticResource BarRadiusX}"
                                   RadiusY="{StaticResource BarRadiusY}"
                                   Fill="{StaticResource BarTopMaskBrush}" />
                            </Canvas>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>

        <Button Content="Export" Height="20" Width="100" Click="Export_Click" />

    </Grid>
</Window>
