<UserControl x:Class="SilverlightApplication1.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mscorlib="clr-namespace:System;assembly=mscorlib"
    xmlns:control="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Charting"
    xmlns:chart="clr-namespace:Telerik.Windows.Controls.Charting;assembly=Telerik.Windows.Controls.Charting"
    xmlns:navigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls">

    <Grid x:Name="LayoutRoot">
        <Grid.Resources>
            <telerik:ContainerBindingCollection x:Key="ContainerBindings">
                <telerik:ContainerBinding PropertyName="IsCheckable" Binding="{Binding IsCheckable}" />
                <telerik:ContainerBinding PropertyName="IsChecked" Binding="{Binding IsChecked}" />
                <telerik:ContainerBinding PropertyName="IsSeparator" Binding="{Binding IsSeparator}" />
                <telerik:ContainerBinding PropertyName="IsEnabled" Binding="{Binding IsEnabled}" />
                <telerik:ContainerBinding PropertyName="StaysOpenOnClick" Binding="{Binding StaysOpenOnClick}" />
                <telerik:ContainerBinding PropertyName="Icon" Binding="{Binding Image}" />
            </telerik:ContainerBindingCollection>

            <telerik:HierarchicalDataTemplate x:Key="MenuItemTemplate" ItemsSource="{Binding Items}"
				telerik:ContainerBinding.ContainerBindings="{StaticResource ContainerBindings}">
                <TextBlock Text="{Binding Text}" />
            </telerik:HierarchicalDataTemplate>

            <mscorlib:Double x:Key="BarRadiusX">2</mscorlib:Double>
            <mscorlib:Double x:Key="BarRadiusY">2</mscorlib:Double>
            <LinearGradientBrush x:Key="BarMaskBrush" EndPoint="1,0.5" StartPoint="0,0.5">
                <GradientStop Color="#00FFFFFF" Offset="0"/>
                <GradientStop Color="#00FFFFFF" Offset="1"/>
                <GradientStop Color="#26000000" Offset="0.2"/>
                <GradientStop Color="#66000000" Offset="0.2"/>
            </LinearGradientBrush>
            <SolidColorBrush x:Key="BarOpacityMaskBrush" Color="#FF000000" />
            <SolidColorBrush x:Key="BarTopMaskBrush" Color="Transparent" />

            <Style x:Key="CustomStyle" TargetType="chart:Bar">
                <Setter Property="Template" >
                    <Setter.Value>
                        <ControlTemplate TargetType="chart:Bar">
                            <Canvas Opacity="0" x:Name="PART_CanvasContainer">

                                <navigation:RadContextMenu.ContextMenu>
                                    <navigation:RadContextMenu ItemsSource="{Binding DataItem.MenuItems}"
                                                               ItemTemplate="{StaticResource MenuItemTemplate}"
                                                               ItemClick="OnContextMenuClick" />
                                </navigation:RadContextMenu.ContextMenu>

                                <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 BarRadiusX}"
                                   RadiusY="{StaticResource BarRadiusY}"
                                   OpacityMask="{StaticResource BarOpacityMaskBrush}"
                                   Fill="{StaticResource BarMaskBrush}" />
                                <Rectangle Height="{TemplateBinding ItemActualHeight}"
                                   Width="{TemplateBinding ItemActualWidth}"
                                   RadiusX="{StaticResource BarRadiusX}"
                                   RadiusY="{StaticResource BarRadiusY}"
                                   Fill="{StaticResource BarTopMaskBrush}" />
                                <Canvas.RenderTransform>
                                    <ScaleTransform x:Name="PART_AnimationTransform" ScaleY="0" />
                                </Canvas.RenderTransform>
                            </Canvas>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>

        <control:RadChart x:Name="RadChart1" ItemsSource="{Binding Data}">
            
            <control:RadChart.SeriesMappings>
                
                <chart:SeriesMapping>    
                    <chart:SeriesMapping.SeriesDefinition>
                        <chart:BarSeriesDefinition ItemStyle="{StaticResource CustomStyle}" />
                    </chart:SeriesMapping.SeriesDefinition>
                    <chart:SeriesMapping.ItemMappings>
                        <chart:ItemMapping FieldName="YValue" DataPointMember="YValue" />
                    </chart:SeriesMapping.ItemMappings>
                </chart:SeriesMapping>

            </control:RadChart.SeriesMappings>
            
        </control:RadChart>

    </Grid>

</UserControl> 