changing cell Background color after editing

19 posts, 0 answers
  1. reema
    reema avatar
    30 posts
    Member since:
    Oct 2008

    Posted 14 Apr 2009 Link to this post

    hi,

    OnRowEditEnded event handler , the line : "cell.Background = new SolidColorBrush(Colors.Red);"  is not working ....WHY?

    thx

     

  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 14 Apr 2009 Link to this post

    Hi reema,

    I believe this is a kind of bug . We are going to fix this one. Thanks for the report ! . I have Updated your Telerik points. Meanwhile I may offer you the following workarround.

    ((Grid) VisualTreeHelper.GetChild(e.Cell, 0)).Background = new SolidColorBrush(Colors.Red);



    Regards,
    Pavel Pavlov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. reema
    reema avatar
    30 posts
    Member since:
    Oct 2008

    Posted 15 Apr 2009 Link to this post

    hi,

    but I have this error now:
    "Unable to cast object of type 'System.Windows.Controls.Border' to type 'System.Windows.Controls.Grid'."
    thx
  4. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 16 Apr 2009 Link to this post

    Hello reema,

    Depending on the theme and the version the first child of the Cell may be a grid or a border.

    Please try the following  (replace Grid with Border) :

    ((Border) VisualTreeHelper.GetChild(e.Cell, 0)).Background = new SolidColorBrush(Colors.Red);

    If you still have troubles let me know . In such case I would need the version of the RadGridView you are using and the theme (if not default ).

    Kind regards,
    Pavel Pavlov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. reema
    reema avatar
    30 posts
    Member since:
    Oct 2008

    Posted 18 Apr 2009 Link to this post

    hi,

    many thanks for reply...
    after installing the latest version of Rad Grid View there is no error with

    "((Grid)VisualTreeHelper.GetChild(cell, 0)).Background = new SolidColorBrush(Colors.Red);"

    but at run nothing happens..
    another thing is I tryed to use : 

    cell.Editor.Background =

    new SolidColorBrush(Colors.Red);
    or

     

    cell.Editor.Value =

    "value";

     

    but again it is not working ...Plz help

    Thx  
  6. Andrew
    Andrew avatar
    26 posts
    Member since:
    Apr 2009

    Posted 19 Apr 2009 Link to this post

    Hi,

    I am having a similar problem

     
     SomeDataGrid.CellEditEnded += new EventHandler<GridViewCellEditEndedEventArgs>(SomeDataGrid_CellEditEnded); 
      
      
     
    void SomeDataGrid_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e) 
            { 
      
                    ToolTipService.SetToolTip(e.Cell.ParentRow, "Some Message"); 
                    e.Cell.ParentRow.Background = new SolidColorBrush(System.Windows.Media.Colors.Red);             
            } 


    Neither of the above commands work



    But the following does work


    void SomeDataGrid_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e) 
            { 
      
                    ToolTipService.SetToolTip(SomeDataGrid, "Some Message"); 
                    SomeDataGrid.Background = new SolidColorBrush(System.Windows.Media.Colors.Red);             
            } 


    Suggestions / workarounds?


    Also, to Reema, you may want to read this post to make sure your events are firing correctly:
    http://www.telerik.com/community/forums/silverlight/gridview/gridviewrow-editendedevent-does-nothing.aspx




  7. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 21 Apr 2009 Link to this post

    Hello Andrew,

    The problem lays down in our GridViewRow template and how VisualStateManager works internally. I have prepared an example that has slightly modified RowStyle allowing your scenario to work correctly. Hope you will find it useful.

    Reema, is this sample also working for your case?

    Greetings,
    Stefan Dobrev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. reema
    reema avatar
    30 posts
    Member since:
    Oct 2008

    Posted 22 Apr 2009 Link to this post


    hi,

    what I need is to change the edited cell background color not the row ..

    I tryed this but still it is  not working  ......e.Cell.Background = new SolidColorBrush(Colors.Red);

    thx..
  9. Stefan Dobrev
    Admin
    Stefan Dobrev avatar
    790 posts

    Posted 22 Apr 2009 Link to this post

    Hi reema,

    Again this is problem related to our control styles combined with visual state manager. I'm attaching a sample project that should handle your scenario.

    Hope this helps.

    All the best,
    Stefan Dobrev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  10. rajeev kumar
    rajeev kumar avatar
    16 posts
    Member since:
    Oct 2009

    Posted 28 Jan 2010 Link to this post

       Hi Stefan,

     I am not getting VisualStateManager for wpf rad grid. I have commented the all control inside VisualStateManager tag.I am able to change the cell background only if I am moving my cursor to same row of grid after editing the cell.If I am moving to different row of grid after editing cell, the OnCellEditEnded event is firing, but no change in background of edited cell.If I am moving to  different row, the changed background of cell is disappearing.I want background of all edited cells should change.So, please give solution.


    Regards,
    Rajeev
  11. Deborah
    Deborah avatar
    31 posts
    Member since:
    Jun 2011

    Posted 29 Jun 2011 Link to this post

    Any news?
    I have the same problem...

    e.Cell.Background = new SolidColorBrush(Colors.Green);

    change the color if I move to another cell of the same row, but if I move to another row the cell background color disappear.
    Could someone help me, please?

    Deborah
  12. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 30 Jun 2011 Link to this post

    Hello Deborah,

    Could you please provide more information about you scenario? What is the exact functionality that you would like to implement?

    Regards,
    Milan
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  13. Deborah
    Deborah avatar
    31 posts
    Member since:
    Jun 2011

    Posted 30 Jun 2011 Link to this post

    Hello Milan,
    I want to change the color of edited cell.
    I'm trying to use the CellEditEnded event, changing the background color of the cell if NewData is different from OldData.
    But the command

    e.Cell.Background = new SolidColorBrush(Colors.Green);

    changes the color only if I move to another cell of the same row; if I move to another row the cell background color disappears.
    Could you help me?

    Thanks,
    Deborah

     

  14. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 04 Jul 2011 Link to this post

    Hello Deborah,

     
    May you please share with us the implementation of RadGridView's CellEditEnded event handler? 


    Regards,
    Vanya Pavlova
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  15. Deborah
    Deborah avatar
    31 posts
    Member since:
    Jun 2011

    Posted 04 Jul 2011 Link to this post

    private void gridBonus_CellEditEnded(object sender, GridViewCellEditEndedEventArgs e)
    {
                if (e.EditAction == GridViewEditAction.Cancel)
                {
                    return;
                }
      
                 if (e.OldData.ToString() != e.NewData.ToString())
                 {
                    e.Cell.Background = new SolidColorBrush(Colors.Red);
                 }
    }

    Deborah 

  16. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 07 Jul 2011 Link to this post

    Hi Deborah,

     May you please tell us what version of the RadControls are you using? Do you have some styles applied to the GridViewCells?

    Best wishes,
    Didie
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  17. Deborah
    Deborah avatar
    31 posts
    Member since:
    Jun 2011

    Posted 07 Jul 2011 Link to this post

    Version: 01 2011 SP1
    Release date: 2011/04/19

    I don't have applied a particular style to the gridview cells...

    Thanks,
    Deborah
  18. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 12 Jul 2011 Link to this post

    Hi Deborah,

    The reason for such a behavior would be that the data virtualization is on. In order to apply the desired cell style without a problem, I would recommend you to use a Cell StyleSelector.

    1. You will need to provide a property of the data item, showing if the cell has been changed or not.

    public bool HasChanged
            {
                get { return this.hasChanged; }
                set
                {
                    if (value != this.hasChanged)
                    {
                        this.hasChanged = value;
                        this.OnPropertyChanged("HasChanged");
                    }
                }
            }

    2. Then you need to apply a style selector to change the color of the cell.
    this.playersGrid.Columns[0].CellStyleSelector = new MyStyleSelector();

    3. On CellEditEnded event set the value of the HasChanged property appropriately.

    I am attaching a sample project to illustrate that approach.

    May you please review the example project and share if this is solving your problem?

    Kind regards,
    Didie
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  19. Sean
    Sean avatar
    1 posts
    Member since:
    Oct 2011

    Posted 27 Oct 2011 Link to this post

    Ok, I'm also having an issue with the cell background color which I am trying to alter dynamically.  This is residing on a SharePoint site and I am bringing in the information from a sharepoint calendar.  When there is a date on the calendar I would like to change the background color of the cell on the Silverlight calendar but haven't been able to accomplish that so far.  I am including the mainpage.xaml and the mainpage.xaml.cs files that I have.  Any suggestions would be welcome.
    Thanks,

    <UserControl
        xmlns:local="clr-namespace:SilverlightSharePointCalendar"
        xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
        xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"              
        xmlns:toolkitData="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Toolkit"   
        xmlns:my="clr-namespace:SilverlightSharePointCalendar.SandboxCalendar"
        xmlns:System="clr-namespace:System;assembly=mscorlib"
        xmlns:System_Windows_Controls_Primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls"
        xmlns:Telerik_Windows_Controls_Calendar="clr-namespace:Telerik.Windows.Controls.Calendar;assembly=Telerik.Windows.Controls.Input"
        xmlns:Telerik_Windows_Controls_Chromes="clr-namespace:Telerik.Windows.Controls.Chromes;assembly=Telerik.Windows.Controls"
        xmlns:gvp="clr-namespace:Telerik.Windows.Controls.GridView;assembly=SilverlightSharePointCalendar"
        x:Class="SilverlightSharePointCalendar.MainPage"   
        mc:Ignorable="d" Height="Auto" Width="400" Loaded="UserControl_Loaded">
     
        <UserControl.Resources>
            <SolidColorBrush x:Key="GrayBackgroundBrush" Color="#a6a8ab" />
            <SolidColorBrush x:Key="PurpleBrush" Color="#FF05aa0c" />
            <SolidColorBrush x:Key="DarkGrayBrush" Color="#676767" />
            <SolidColorBrush x:Key="TransparentBrush" Color="Transparent" />
        </UserControl.Resources>
     
         
        <Grid x:Name="LayoutRoot" Width="400">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="29" />
            </Grid.RowDefinitions>
             
            <telerik:RadGridView x:Name="gridMonthView" HorizontalAlignment="Left" Margin="310,5,0,0" VerticalAlignment="Top" AutoGenerateColumns="False" BorderThickness="0" CanUserDeleteRows="False" CanUserFreezeColumns="False" CanUserInsertRows="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False" EnableColumnVirtualization="False" EnableRowVirtualization="False" GridLinesVisibility="None" IsFilteringAllowed="False" IsReadOnly="True" SelectionUnit="FullRow" ShowColumnHeaders="False" ShowGroupPanel="False" VerticalGridLinesBrush="{x:Null}" RowIndicatorVisibility="Collapsed" ColumnWidth="*" Width="90" Height="300" SelectionChanged="gridMonthView_SelectionChanged" RowLoaded="gridMonthView_RowLoaded" Background="{x:Null}" BorderBrush="#00848484" DataLoaded="gridMonthView_DataLoaded">
                <telerik:RadGridView.Resources>
                    <SolidColorBrush x:Key="ItemOuterBorder_Over"/>
                    <SolidColorBrush x:Key="ItemInnerBorder_Over" Color="Transparent"/>
                     
                    <SolidColorBrush x:Key="ItemBackground_Over" Color="#00542989"/>
                     
                    <SolidColorBrush x:Key="ItemOuterBorder_Selected"/>
                    <SolidColorBrush x:Key="ItemInnerBorder_Selected" Color="Transparent"/>
                    <SolidColorBrush x:Key="ItemBackground_Selected" Color="#00542989"/>
                    <SolidColorBrush x:Key="ItemOuterBorder_Invalid" Color="#FFCE7D7D"/>
                    <LinearGradientBrush x:Key="ItemInnerBorder_Invalid" EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFEBF4FD"/>
                        <GradientStop Color="#FFDBEAFD" Offset="1"/>
                    </LinearGradientBrush>
                    <LinearGradientBrush x:Key="ItemBackground_Invalid" EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFFCDCDC"/>
                        <GradientStop Color="#FFFCC1C1" Offset="1"/>
                    </LinearGradientBrush>
                    <telerik:BooleanToOpacityConverter x:Key="BooleanToOpacityConverter"/>
                    <telerik:Office_BlackTheme x:Key="Theme"/>
                    <telerik:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
                    <telerik:GridLineWidthToThicknessConverter x:Key="GridLineWidthToThicknessConverter"/>
                    <SolidColorBrush x:Key="ControlOuterBorder" Color="#00848484"/>
                    <SolidColorBrush x:Key="GridView_HierarchyBackground" Color="#00BBBBBB"/>
                     
                    <SolidColorBrush x:Key="GridView_RowIndicatorCellBackground" Color="#FFE4E4E4"/>
                    <SolidColorBrush x:Key="GridView_NavigatorIndicatorBackground" Color="#00848484"/>
                    <SolidColorBrush x:Key="GridView_EditIndicatorBackground1" Color="#7F848484"/>
                    <SolidColorBrush x:Key="GridView_EditIndicatorBackground2" Color="#FFCBCBCB"/>
                    <SolidColorBrush x:Key="GridView_EditIndicatorBackground3" Color="#FF848484"/>
                    <SolidColorBrush x:Key="GridView_EditIndicatorBackground4" Color="White"/>
                    <LinearGradientBrush x:Key="GridView_ErrorIndicatorBackground1" EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFFC9999" Offset="0"/>
                        <GradientStop Color="#FFC26666" Offset="1"/>
                    </LinearGradientBrush>
                    <SolidColorBrush x:Key="GridView_ErrorIndicatorBackground2" Color="White"/>
                    <LinearGradientBrush x:Key="GridView_ErrorIndicatorBackground3" EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="Red" Offset="0"/>
                        <GradientStop Color="#FF990000" Offset="1"/>
                    </LinearGradientBrush>
                     
                   <SolidColorBrush x:Key="GridView_GridLinesItemBorder" Color="#00CBCBCB"/>
                    <SolidColorBrush x:Key="ItemBackground" Color="White"/>
                     
                    <ControlTemplate x:Key="GridViewRowTemplate" TargetType="telerik:GridViewRow">
                        <Border BorderThickness="{TemplateBinding BorderThickness}">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Unfocused"/>
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="NavigatorIndicator">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="SelectionStates">
                                    <VisualState x:Name="Unselected"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Background_Over">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Background_Selected">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="NavigatorIndicatorBackground">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource TransparentBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="ValueStates">
                                    <VisualState x:Name="Valid"/>
                                    <VisualState x:Name="Invalid">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Background_Invalid">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ErrorIndicator">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="EditIndicator">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="NavigatorIndicator">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="EditStates">
                                    <VisualState x:Name="ReadOnlyMode"/>
                                    <VisualState x:Name="EditMode">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="EditIndicator">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="NavigatorIndicator">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <telerik:SelectiveScrollingGrid x:Name="grid">
                                <telerik:SelectiveScrollingGrid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </telerik:SelectiveScrollingGrid.ColumnDefinitions>
                                <telerik:SelectiveScrollingGrid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </telerik:SelectiveScrollingGrid.RowDefinitions>
                                <Border x:Name="SelectionBackground" Grid.ColumnSpan="2" Grid.Column="2" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" Margin="{TemplateBinding Margin}" MinWidth="{Binding RenderWidth, RelativeSource={RelativeSource TemplatedParent}}" Padding="{TemplateBinding Padding}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                <Border x:Name="Background_Over" BorderThickness="1" Grid.ColumnSpan="2" Grid.Column="2" CornerRadius="1" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" Margin="1,1,1,2" MinWidth="{Binding RenderWidth, RelativeSource={RelativeSource TemplatedParent}}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="Collapsed">
                                    <Border BorderThickness="1" BorderBrush="#FF676767"/>
                                </Border>
                                <Border x:Name="Background_Selected" BorderThickness="1" Grid.ColumnSpan="2" Grid.Column="2" CornerRadius="1" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" Margin="1,1,1,2" MinWidth="{Binding RenderWidth, RelativeSource={RelativeSource TemplatedParent}}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="Collapsed" Background="{StaticResource ItemOuterBorder_Selected}">
                                    <Border BorderThickness="1"/>
                                </Border>
                                <Border x:Name="Background_Invalid" BorderBrush="{StaticResource ItemOuterBorder_Invalid}" BorderThickness="1" Grid.ColumnSpan="2" Grid.Column="2" CornerRadius="1" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" Margin="1,1,1,2" MinWidth="{Binding RenderWidth, RelativeSource={RelativeSource TemplatedParent}}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="Collapsed">
                                    <Border BorderBrush="{StaticResource ItemInnerBorder_Invalid}" BorderThickness="1" Background="{StaticResource ItemBackground_Invalid}"/>
                                </Border>
                                <telerik:GridViewToggleButton x:Name="PART_HierarchyExpandButton" Grid.Column="2" IsHitTestVisible="{Binding IsExpandable, RelativeSource={RelativeSource TemplatedParent}}" IsTabStop="{TemplateBinding IsTabStop}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Opacity="{Binding IsExpandable, Converter={StaticResource BooleanToOpacityConverter}, RelativeSource={RelativeSource TemplatedParent}}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="{Binding HasHierarchy, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}" Width="25" BorderBrush="#00000000" Foreground="#FF676767"/>
                                <Border Grid.Column="2" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding HasHierarchy, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}"/>
                                <telerik:DataCellsPresenter x:Name="PART_DataCellsPresenter" Grid.Column="3" telerik:StyleManager.Theme="{StaticResource Theme}"/>
                                <Border x:Name="PART_RowBorder" BorderThickness="{Binding HorizontalGridLinesWidth, ConverterParameter=Bottom, Converter={StaticResource GridLineWidthToThicknessConverter}, RelativeSource={RelativeSource TemplatedParent}}" Grid.ColumnSpan="4" Grid.Column="1" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" MinWidth="{Binding RenderWidth, RelativeSource={RelativeSource TemplatedParent}}" Grid.RowSpan="4" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" VerticalAlignment="Bottom"/>
                                <Border BorderBrush="{StaticResource ControlOuterBorder}" BorderThickness="0,1" Background="{StaticResource GridView_HierarchyBackground}" Grid.ColumnSpan="2" Grid.Column="2" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" MaxWidth="30000" Padding="6" Grid.Row="2" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True" Visibility="{Binding IsExpanded, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}">
                                    <ContentPresenter x:Name="PART_HierarchyChildPresenter" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True"/>
                                </Border>
                                <telerik:DetailsPresenter x:Name="PART_DetailsPresenter" Grid.ColumnSpan="2" Grid.Column="2" DetailsProvider="{TemplateBinding DetailsProvider}" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" MaxWidth="30000" Grid.Row="1" telerik:StyleManager.Theme="{StaticResource Theme}"/>
                                <telerik:IndentPresenter x:Name="PART_IndentPresenter" Grid.Column="1" IndentLevel="{TemplateBinding IndentLevel}" Grid.RowSpan="4" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" telerik:StyleManager.Theme="{StaticResource Theme}"/>
                                <Border x:Name="PART_IndicatorPresenter" BorderBrush="{StaticResource ControlOuterBorder}" BorderThickness="0,0,1,1" Grid.Column="0" Grid.RowSpan="3" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{TemplateBinding RowIndicatorVisibility}" VerticalAlignment="Stretch" Width="25">
                                    <Border x:Name="NavigatorIndicatorBackground" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="1" Background="{StaticResource GridView_RowIndicatorCellBackground}">
                                        <Grid>
                                            <Grid x:Name="NavigatorIndicator" HorizontalAlignment="Center" Height="11" Visibility="Collapsed" VerticalAlignment="Center" Width="11" Background="{StaticResource ControlOuterBorder}">
                                                <Path Data="F1 M 32.0234,6.66669L 24.2923,0.0248413L 28.3697,0.0248413L 32,3.14362L 36.1492,6.70819L 32,10.2728L 28.4664,13.3085L 24.2923,13.3085L 32.0234,6.66669 Z " Fill="{StaticResource GridView_NavigatorIndicatorBackground}" HorizontalAlignment="Center" Height="8" Margin="0" Stretch="Fill" VerticalAlignment="Center" Width="8"/>
                                            </Grid>
                                            <Grid x:Name="EditIndicator" HorizontalAlignment="Center" Height="10" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
                                                <Path Data="M14,9 L15,9 15,10 14,10 z M1,9 L2,9 2,10 1,10 z M15,8 L16,8 16,9 15,9 z M0,8 L1,8 1,9 0,9 z M15,1 L16,1 16,2 15,2 z M0,1 L1,1 1,2 0,2 z M14,0 L15,0 15,1 14,1 z M1,0 L2,0 2,1 1,1 z" Fill="{StaticResource GridView_EditIndicatorBackground1}" Stretch="Fill"/>
                                                <Path Data="M0.99999994,6.9999995 L2,6.9999995 3,6.9999995 4,6.9999995 5,6.9999995 6,6.9999995 7,6.9999995 8,6.9999995 9,6.9999995 10,6.9999995 11,6.9999995 12,6.9999995 13,6.9999995 13,7.9999995 12,7.9999995 11,7.9999995 10,7.9999995 9,7.9999995 8,7.9999995 7,7.9999995 6,7.9999995 5,7.9999995 4,7.9999995 3,7.9999995 2,7.9999995 0.99999994,7.9999995 z M13,0.99999994 L14,0.99999994 14,1.9999999 14,2.9999995 14,3.9999995 14,4.9999995 14,5.9999995 14,6.9999995 13,6.9999995 13,5.9999995 13,4.9999995 13,3.9999995 13,2.9999995 13,1.9999999 z M0,0.99999994 L0.99999994,0.99999994 0.99999994,1.9999999 0.99999994,2.9999995 0.99999994,3.9999995 0.99999994,4.9999995 0.99999994,5.9999995 0.99999994,6.9999995 0,6.9999995 0,5.9999995 0,4.9999995 0,3.9999995 0,2.9999995 0,1.9999999 z M11,0 L12,0 13,0 13,0.99999994 12,0.99999994 11,0.99999994 10,0.99999994 9,0.99999994 8,0.99999994 7,0.99999994 6,0.99999994 5,0.99999994 4,0.99999994 3,0.99999994 2,0.99999994 0.99999994,0.99999994 0.99999994,2.3841858E-07 2,2.3841858E-07 3,2.3841858E-07 4,2.3841858E-07 5,2.3841858E-07 6,2.3841858E-07 7,2.3841858E-07 8,2.3841858E-07 9,2.3841858E-07 10,2.3841858E-07 z" Fill="{StaticResource GridView_EditIndicatorBackground2}" Margin="1" Stretch="Fill"/>
                                                <Path Data="M2,9 L3,9 4,9 5,9 6,9 7,9 8,9 9,9 10,9 11,9 12,9 13,9 14,9 14,10 13,10 12,10 11,10 10,10 9,10 8,10 7,10 6,10 5,10 4,10 3,10 2,10 z M14,8 L15,8 15,9 14,9 z M1,8 L2,8 2,9 1,9 z M15,2 L16,2 16,3 16,4 16,5 16,6 16,7 16,8 15,8 15,7 15,6 15,5 15,4 15,3 z M3,2 L4,2 5,2 6,2 6,3 5,3 5,4 5,5 5,6 5,7 6,7 6,8 5,8 4,8 3,8 3,7 4,7 4,6 4,5 4,4 4,3 3,3 z M0,2 L1,2 1,3 1,4 1,5 1,6 1,7 1,8 0,8 0,7 0,6 0,5 0,4 0,3 z M14,1 L15,1 15,2 14,2 z M1,1 L2,1 2,2 1,2 z M2,0 L3,0 4,0 5,0 6,0 7,0 8,0 9,0 10,0 11,0 12,0 13,0 14,0 14,1 13,1 12,1 11,1 10,1 9,1 8,1 7,1 6,1 5,1 4,1 3,1 2,1 z" Fill="{StaticResource GridView_EditIndicatorBackground3}" Stretch="Fill"/>
                                                <Path Data="M4,0 L5,0 6,0 7,0 8,0 9,0 10,0 11,0 12,0 12,1 12,2 12,3 12,4 12,5.0000001 12,6 11,6 10,6 9,6 8,6 7,6 6,6 5,6 4,6 4,5.0000001 3,5.0000001 3,4 3,3 3,2 3,1 4,1 z M0,0 L1,0 1,1 2,1 2,2 2,3 2,4 2,5.0000001 1,5.0000001 1,6 0,6 0,5.0000001 0,4 0,3 0,2 0,1 z" Fill="{StaticResource GridView_EditIndicatorBackground4}" Margin="2" Stretch="Fill"/>
                                            </Grid>
                                            <Grid x:Name="ErrorIndicator" HorizontalAlignment="Center" Height="16" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
                                                <Path Data="M3,12.999999 L4,12.999999 5,12.999999 6,12.999999 7,12.999999 8,12.999999 9,12.999999 10,12.999999 11,12.999999 11,13.999999 10,13.999999 9,13.999999 8,13.999999 7,13.999999 6,13.999999 5,13.999999 4,13.999999 3,13.999999 z M11,11.999999 L12,11.999999 12,12.999999 11,12.999999 z M2.0000001,11.999999 L3,11.999999 3,12.999999 2.0000001,12.999999 z M12,10.999999 L13,10.999999 13,11.999999 12,11.999999 z M1,10.999999 L2.0000001,10.999999 2.0000001,11.999999 1,11.999999 z M13,2.9999992 L14,2.9999992 14,3.9999992 14,4.9999992 14,5.9999992 14,6.9999992 14,7.9999992 14,8.9999992 14,9.9999992 14,10.999999 13,10.999999 13,9.9999992 13,8.9999992 13,7.9999992 13,6.9999992 13,5.9999992 13,4.9999992 13,3.9999992 z M0,2.9999992 L1,2.9999992 1,3.9999992 1,4.9999992 1,5.9999992 1,6.9999992 1,7.9999992 1,8.9999992 1,9.9999992 1,10.999999 0,10.999999 0,9.9999992 0,8.9999992 0,7.9999992 0,6.9999992 0,5.9999992 0,4.9999992 0,3.9999992 z M12,1.9999999 L13,1.9999999 13,2.9999992 12,2.9999992 z M1,1.9999999 L2.0000001,1.9999999 2.0000001,2.9999992 1,2.9999992 z M11,0.99999994 L12,0.99999994 12,1.9999999 11,1.9999999 z M2.0000001,0.99999994 L2.9999998,0.99999994 2.9999998,1.9999999 2.0000001,1.9999999 z M2.9999998,0 L3.9999998,0 5,0 6,0 7,0 8,0 9,0 10,0 11,0 11,0.99999994 10,0.99999994 9,0.99999994 8,0.99999994 7,0.99999994 6,0.99999994 5,0.99999994 3.9999998,0.99999994 2.9999998,0.99999994 z" Fill="{StaticResource GridView_ErrorIndicatorBackground1}" Margin="1" Stretch="Fill"/>
                                                <Path Data="M1.4901161E-07,8 L1.0000001,8 2.0000002,8 2.0000002,9 2.0000002,10 1.0000003,10 1.0000003,9 1.0000001,10 1.4901161E-07,10 1.4901161E-07,9 z M1.4901161E-07,0 L1.0000001,0 2.0000002,0 2.0000002,1 2.0000002,2 2.0000002,3 2.0000002,4.0000001 2.0000002,5 2.0000002,5.9999999 2.0000002,7 1.0000001,7 1.4901161E-07,7 1.4901161E-07,5.9999999 1.4901161E-07,5 1.4901161E-07,4.0000001 1.4901161E-07,3 1.4901161E-07,2 0,1 z" Fill="{StaticResource GridView_ErrorIndicatorBackground2}" Margin="7,3" Stretch="Fill"/>
                                                <Path Data="M4,15 L5,15 6,15 7,15 8,15 9,15 10,15 11,15 12,15 12,16 11,16 10,16 9,16 8,16 7,16 6,16 5,16 4,16 z M12,14 L13,14 13,15 12,15 z M3,14 L4,14 4,15 3,15 z M13,13 L14,13 14,14 13,14 z M2,13 L3,13 3,14 2,14 z M14,12 L15,12 15,13 14,13 z M1,12 L2,12 2,13 1,13 z M7,11 L7,12 7,13 8,13 9,13 9,12 9,11 8,11 z M15,4 L16,4 16,5 16,6 16,7 16,8 16,9 16,10 16,11 16,12 15,12 15,11 15,10 15,9 15,8 15,7 15,6 15,5 z M0,4 L1,4 1,5 1,6 1,7 1,8 1,9 1,10 1,11 1,12 0,12 0,11 0,10 0,9 0,8 0,7 0,6 0,5 z M14,3 L15,3 15,4 14,4 z M7,3 L7,4 7,5 7,6 7,7 7,8 7,9 7,10 8,10 9,10 9,9 9,8 9,7 9,6 9,5 9,4 9,3 8,3 z M1,3 L2,3 2,4 1,4 z M13,2 L14,2 14,3 13,3 z M4,2 L5,2 6,2 7,2 8,2 9,2 10,2 11,2 12,2 12,3 13,3 13,4 14,4 14,5 14,6 14,7 14,8 14,9 14,10 14,11 14,12 13,12 13,13 12,13 12,14 11,14 10,14 9,14 8,14 7,14 6,14 5,14 4,14 4,13 3,13 3,12 2,12 2,11 2,10 2,9 2,8 2,7 2,6 2,5 2,4 3,4 3,3 4,3 z M2,2 L3,2 3,3 2,3 z M12,1 L13,1 13,2 12,2 z M3,1 L4,1 4,2 3,2 z M4,0 L5,0 6,0 7,0 8,0 9,0 10,0 11,0 12,0 12,1 11,1 10,1 9,1 8,1 7,1 6,1 5,1 4,1 z" Fill="{StaticResource GridView_ErrorIndicatorBackground3}" Stretch="Fill"/>
                                            </Grid>
                                        </Grid>
                                    </Border>
                                </Border>
                            </telerik:SelectiveScrollingGrid>
                        </Border>
                    </ControlTemplate>
                    <Style x:Key="MonthRowStyle" TargetType="telerik:GridViewRow">
                        <Setter Property="IsTabStop" Value="False"/>
                        <Setter Property="Template" Value="{StaticResource GridViewRowTemplate}"/>
                        <Setter Property="BorderThickness" Value="0"/>
                        <Setter Property="FontWeight" Value="Normal"/>
                        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                        <Setter Property="Padding" Value="0"/>
                        <Setter Property="FontFamily" Value="Segoe UI"/>
                        <Setter Property="FontSize" Value="13.333"/>
                        <Setter Property="Foreground" Value="#FF676767"/>
                    </Style>
                </telerik:RadGridView.Resources>
                <telerik:RadGridView.AlternateRowBackground>
                    <StaticResource ResourceKey="GridView_GridLinesItemBorder"/>
                </telerik:RadGridView.AlternateRowBackground>
                <telerik:RadGridView.RowStyle>
                    <StaticResource ResourceKey="MonthRowStyle"/>
                </telerik:RadGridView.RowStyle>
                 
                 
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn IsFilterable="False" IsGroupable="False" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" ShowDistinctFilters="False" UniqueName="gridViewMonth" DataMemberBinding="{Binding Name}" />
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
     
            <telerik:RadCalendar HorizontalAlignment="Left" Margin="5,5,0,0" x:Name="calendar1" VerticalAlignment="Top" Height="300" Width="300"  HeaderVisibility="Collapsed" AreWeekNamesVisible="False" AreWeekNumbersVisible="False" BorderBrush="#FF542989" BorderThickness="0" IsTodayHighlighted="False" SelectionMode="Multiple" FontFamily="Segoe UI" FontSize="13.333" Foreground="White">
                <telerik:RadCalendar.Resources>
                    <CornerRadius x:Key="SplitButton_SpanCornerRadius">1</CornerRadius>
                    <Thickness x:Key="CalendarButtonButtonChromeMargin">2</Thickness>
                    <telerik:Office_BlackTheme x:Key="Theme"/>
                     
                    <Thickness x:Key="CalendarButtonTodayVisualMargin">1</Thickness>
     
                    <SolidColorBrush x:Key="ControlOuterBorder_Normal" Color="Black"/>
                    <SolidColorBrush x:Key="ControlInnerBorder_Normal" Color="Black"/>
                    <System:Double x:Key="ControlOuterBorderGradientStop0">0</System:Double>
                    <System:Double x:Key="ControlOuterBorderGradientStop1">1</System:Double>
                    <System:Double x:Key="ControlBackgroundGradientStop0">0</System:Double>
                    <System:Double x:Key="ControlBackgroundGradientStop1">0.5</System:Double>
                    <System:Double x:Key="ControlBackgroundGradientStop2">0.5</System:Double>
                    <System:Double x:Key="ControlBackgroundGradientStop3">1</System:Double>
                    <System:Double x:Key="ControlInnerBorderGradientStop0">0</System:Double>
                    <System:Double x:Key="ControlInnerBorderGradientStop1">0.169</System:Double>
                     
                    <SolidColorBrush x:Key="ControlOuterBorder_Focused" Color="#FFA6A8AB"/>
                     
                     
                     
                    <Color x:Key="ControlOuterBorder_Active_Stop0">#FFFFC92B</Color>
                    <Color x:Key="ControlOuterBorder_Active_Stop1">#FFFFC92B</Color>
                    <Color x:Key="ControlInnerBorder_Active_Stop0">#FFFFFFFF</Color>
                    <Color x:Key="ControlInnerBorder_Active_Stop1">#FFFFFFFF</Color>
                    <Color x:Key="ControlBackground_Active_Stop0">#FFFFFEF3</Color>
                    <Color x:Key="ControlBackground_Active_Stop1">#FFFCF7D1</Color>
                    <Color x:Key="ControlBackground_Active_Stop2">#FFFCF7D1</Color>
                    <Color x:Key="ControlBackground_Active_Stop3">#FFFAF0AF</Color>
                    <Color x:Key="ControlOuterBorder_MouseOver_Stop0">#FFFFC92B</Color>
                    <Color x:Key="ControlOuterBorder_MouseOver_Stop1">#FFFFC92B</Color>
                    <Color x:Key="ControlInnerBorder_MouseOver_Stop0">#FFFFFFFF</Color>
                    <Color x:Key="ControlInnerBorder_MouseOver_Stop1">#FFFFFFFF</Color>
                    <Color x:Key="ControlBackground_MouseOver_Stop0">#FFFFFBDA</Color>
                    <Color x:Key="ControlBackground_MouseOver_Stop1">#FFFEEBAE</Color>
                    <Color x:Key="ControlBackground_MouseOver_Stop2">#FFFFD25A</Color>
                    <Color x:Key="ControlBackground_MouseOver_Stop3">#FFFFFBA3</Color>
                     
                    <SolidColorBrush x:Key="ControlOuterBorder_Highlighted" Color="#00FFC92B"/>
                     
                     
                    <SolidColorBrush x:Key="ControlBackground_Highlighted"/>
                    <SolidColorBrush x:Key="ControlOuterBorder_Selected" Color="#00FFC92B"/>
                     
                     
                     
                    <Color x:Key="ControlOuterBorder_Checked_Stop0">#FFFFC92B</Color>
                    <Color x:Key="ControlOuterBorder_Checked_Stop1">#FFFFC92B</Color>
                    <Color x:Key="ControlInnerBorder_Checked_Stop0">#FFFFFFFF</Color>
                    <Color x:Key="ControlInnerBorder_Checked_Stop1">#FFFFFFFF</Color>
                    <Color x:Key="ControlBackground_Checked_Stop0">#FFFFDCAB</Color>
                    <Color x:Key="ControlBackground_Checked_Stop1">#FFFFD18F</Color>
                    <Color x:Key="ControlBackground_Checked_Stop2">#FFFE9227</Color>
                    <Color x:Key="ControlBackground_Checked_Stop3">#FFFFD74E</Color>
                     
                    <SolidColorBrush x:Key="ControlOuterBorder_DisabledChecked"/>
                     
                    <LinearGradientBrush x:Key="ControlInnerBorder_DisabledChecked" EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFB69A78"/>
                        <GradientStop Color="#FFFFE17A" Offset="0.125"/>
                    </LinearGradientBrush>
                     
                     
                    <Color x:Key="ControlOuterBorder_MouseOverChecked_Stop0">#FF282828</Color>
                    <Color x:Key="ControlOuterBorder_MouseOverChecked_Stop1">#FF5F5F5F</Color>
                    <Color x:Key="ControlInnerBorder_MouseOverChecked_Stop0">#FFB69A78</Color>
                    <Color x:Key="ControlInnerBorder_MouseOverChecked_Stop1">#FFFFE17A</Color>
                    <Color x:Key="ControlBackground_MouseOverChecked_Stop0">#FFFFE8AB</Color>
                    <Color x:Key="ControlBackground_MouseOverChecked_Stop1">#FFFFE08F</Color>
                    <Color x:Key="ControlBackground_MouseOverChecked_Stop2">#FFFEAF27</Color>
                    <Color x:Key="ControlBackground_MouseOverChecked_Stop3">#FFFFE74E</Color>
                    <Color x:Key="ControlOuterBorder_Pressed_Stop0">#FF282828</Color>
                    <Color x:Key="ControlOuterBorder_Pressed_Stop1">#FF5F5F5F</Color>
                    <Color x:Key="ControlInnerBorder_Pressed_Stop0">#FFB69A78</Color>
                    <Color x:Key="ControlInnerBorder_Pressed_Stop1">#FFFFE17A</Color>
                    <Color x:Key="ControlBackground_Pressed_Stop0">#FFFFDCAB</Color>
                    <Color x:Key="ControlBackground_Pressed_Stop1">#FFFFD18F</Color>
                    <Color x:Key="ControlBackground_Pressed_Stop2">#FFFE9227</Color>
                    <Color x:Key="ControlBackground_Pressed_Stop3">#FFFFBA74</Color>
                     
                    <SolidColorBrush x:Key="ControlOuterBorder_Disabled" Color="#00989898"/>
                     
                    <SolidColorBrush x:Key="ControlBackground_Disabled" Color="White"/>
                    <Color x:Key="ControlOuterBorder_Normal_Stop0">#FF848484</Color>
                    <Color x:Key="ControlOuterBorder_Normal_Stop1">#FF848484</Color>
                    <Color x:Key="ControlInnerBorder_Normal_Stop0">#FFFFFFFF</Color>
                    <Color x:Key="ControlInnerBorder_Normal_Stop1">#FFFFFFFF</Color>
                    <Color x:Key="ControlBackground_Normal_Stop0">#FFFFFFFF</Color>
                    <Color x:Key="ControlBackground_Normal_Stop1">#FFDCDCDC</Color>
                    <Color x:Key="ControlBackground_Normal_Stop2">#FFADADAD</Color>
                    <Color x:Key="ControlBackground_Normal_Stop3">#FFD4D4D4</Color>
                     
                    <Style x:Key="SelectionChromeTemplate" TargetType="Telerik_Windows_Controls_Chromes:ButtonChrome">
                        <Setter Property="IsTabStop" Value="False"/>
                        <Setter Property="Background" Value="{StaticResource ControlBackground_Disabled}"/>
                        <Setter Property="BorderBrush" Value="{StaticResource ControlOuterBorder_Normal}"/>
                        <Setter Property="BorderThickness" Value="1"/>
                        <Setter Property="CornerRadius" Value="{StaticResource SplitButton_SpanCornerRadius}"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="Telerik_Windows_Controls_Chromes:ButtonChrome">
                                    <Grid Background="{StaticResource ControlOuterBorder_Focused}">
                                        <VisualStateManager.VisualStateGroups>
                                            <VisualStateGroup x:Name="CommonStatesGroup">
                                                <VisualStateGroup.Transitions>
                                                    <VisualTransition From="MouseOver" GeneratedDuration="00:00:00.150" To="None"/>
                                                    <VisualTransition From="Active" GeneratedDuration="00:00:00.150" To="None"/>
                                                </VisualStateGroup.Transitions>
                                                <VisualState x:Name="None">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="OuterBorder">
                                                            <LinearDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <LinearDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource ControlInnerBorder_Active_Stop0}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.0" Value="{StaticResource ControlInnerBorder_Active_Stop1}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Normal">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.150" Value="Transparent"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.150" Value="Transparent"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Active">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.115" Value="{StaticResource ControlInnerBorder_MouseOver_Stop0}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.115" Value="{StaticResource ControlInnerBorder_MouseOver_Stop1}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Selected">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="OuterBorder">
                                                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlOuterBorder_Selected}"/>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Background" Storyboard.TargetName="OuterBorder">
                                                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource TransparentBrush}"/>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Checked">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.150" Value="{StaticResource ControlInnerBorder_Checked_Stop0}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.150" Value="{StaticResource ControlInnerBorder_Checked_Stop1}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="DisabledChecked">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="OuterBorder">
                                                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlOuterBorder_DisabledChecked}"/>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Background" Storyboard.TargetName="OuterBorder">
                                                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource TransparentBrush}"/>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="MouseOverChecked">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:00.115" Value="1"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CommonStatesWrapper">
                                                            <DiscreteDoubleKeyFrame KeyTime="00:00:00.115" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.115" Value="{StaticResource ControlInnerBorder_MouseOverChecked_Stop0}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.115" Value="{StaticResource ControlInnerBorder_MouseOverChecked_Stop1}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="MouseOver">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CommonStatesWrapper">
                                                            <DiscreteDoubleKeyFrame KeyTime="00:00:00.115" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.115" Value="{StaticResource ControlInnerBorder_MouseOver_Stop0}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.115" Value="{StaticResource ControlInnerBorder_MouseOver_Stop1}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="OuterBorder">
                                                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlOuterBorder_Disabled}"/>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Background" Storyboard.TargetName="OuterBorder">
                                                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlBackground_Disabled}"/>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="NoneVertical">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="OuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.EndPoint)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <DiscretePointKeyFrame KeyTime="0:0:0" Value="1,0"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.150" Value="Transparent"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.150" Value="Transparent"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="NormalVertical">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.EndPoint)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <DiscretePointKeyFrame KeyTime="0:0:0" Value="1,0"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.150" Value="{StaticResource ControlInnerBorder_Normal_Stop0}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.150" Value="{StaticResource ControlInnerBorder_Normal_Stop1}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="MouseOverVertical">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.EndPoint)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <DiscretePointKeyFrame KeyTime="0:0:0" Value="1,0"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CommonStatesWrapper">
                                                            <DiscreteDoubleKeyFrame KeyTime="00:00:00.115" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.115" Value="{StaticResource ControlInnerBorder_MouseOver_Stop0}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.115" Value="{StaticResource ControlInnerBorder_MouseOver_Stop1}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="PressedVertical">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CommonStatesWrapper">
                                                            <DiscreteDoubleKeyFrame KeyTime="00:00:00.050" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.EndPoint)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <DiscretePointKeyFrame KeyTime="0:0:0" Value="1,0"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.050" Value="{StaticResource ControlInnerBorder_Pressed_Stop0}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <SplineColorKeyFrame KeyTime="00:00:00.050" Value="{StaticResource ControlInnerBorder_Pressed_Stop1}"/>
                                                        </ColorAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="DisabledVertical">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="AnimatedCommonOuterBorder">
                                                            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                        <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(GradientBrush.EndPoint)" Storyboard.TargetName="AnimatedCommonInnerBorder">
                                                            <DiscretePointKeyFrame KeyTime="0:0:0" Value="1,0"/>
                                                        </PointAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="OuterBorder">
                                                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlOuterBorder_Disabled}"/>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0:0:0" Storyboard.TargetProperty="Background" Storyboard.TargetName="OuterBorder">
                                                            <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource ControlBackground_Disabled}"/>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="FocusStatesGroup">
                                                <VisualState x:Name="Unfocused">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FocusVisual">
                                                            <DiscreteObjectKeyFrame KeyTime="00:00:00.150">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisual">
                                                            <LinearDoubleKeyFrame KeyTime="00:00:00.150" Value="0"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Focused">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="FocusVisual">
                                                            <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisual">
                                                            <LinearDoubleKeyFrame KeyTime="00:00:00.115" Value="1"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                        </VisualStateManager.VisualStateGroups>
                                        <Border x:Name="OuterBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="{TemplateBinding CornerRadius}">
                                            <Border x:Name="InnerBorder" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1"/>
                                        </Border>
                                        <Border x:Name="AnimatedCommonOuterBorder" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" Background="{StaticResource TransparentBrush}">
                                            <Border x:Name="AnimatedCommonInnerBorder" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1">
                                                <Border.BorderBrush>
                                                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                                        <GradientStop Color="#FFFFFFFF" Offset="{StaticResource ControlInnerBorderGradientStop0}"/>
                                                        <GradientStop Color="Transparent" Offset="{StaticResource ControlInnerBorderGradientStop1}"/>
                                                    </LinearGradientBrush>
                                                </Border.BorderBrush>
                                            </Border>
                                        </Border>
                                        <Border x:Name="CommonStatesWrapper">
                                            <Border x:Name="FocusVisual" BorderThickness="{TemplateBinding BorderThickness}" Background="{StaticResource ControlOuterBorder_Selected}" CornerRadius="{TemplateBinding CornerRadius}" Opacity="0" Visibility="Collapsed">
                                                <Border x:Name="FocusInnerVisual" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="1" CornerRadius="{TemplateBinding InnerCornerRadius}"/>
                                            </Border>
                                        </Border>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                     
                    <Style x:Key="DayButtonStyle" TargetType="Telerik_Windows_Controls_Calendar:CalendarButton">
                        <Setter Property="Padding" Value="0"/>
                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                        <Setter Property="VerticalContentAlignment" Value="Center"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="Telerik_Windows_Controls_Calendar:CalendarButton">
                                    <Grid x:Name="LayoutRoot" Background="Transparent">
                                        <VisualStateManager.VisualStateGroups>
                                            <VisualStateGroup x:Name="CommonStates">
                                                <VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="LayoutRoot">
                                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="0.5"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Normal"/>
                                                <VisualState x:Name="MouseOver"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="ViewStates">
                                                <VisualState x:Name="IsInAnotherView"/>
                                                <VisualState x:Name="IsNotFromCurrentView">
                                                    <Storyboard>
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Content">
                                                            <DiscreteDoubleKeyFrame KeyTime="0" Value="0.5"/>
                                                        </DoubleAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="ButtonType">
                                                <VisualState x:Name="Year"/>
                                                <VisualState x:Name="Decade"/>
                                                <VisualState x:Name="Date"/>
                                                <VisualState x:Name="WeekName">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="SelectionChrome">
                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="WeekNumber">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="SelectionChrome">
                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="TodayDate">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="TodayVisual">
                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Month"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="FocusStates">
                                                <VisualState x:Name="Unfocused"/>
                                                <VisualState x:Name="Focused"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="SelectionStates">
                                                <VisualState x:Name="Unselected"/>
                                                <VisualState x:Name="Selected"/>
                                            </VisualStateGroup>
                                        </VisualStateManager.VisualStateGroups>
                                        <Border BorderBrush="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
                                        <Telerik_Windows_Controls_Chromes:ButtonChrome x:Name="SelectionChrome" CornerRadius="{StaticResource SplitButton_SpanCornerRadius}" Margin="{StaticResource CalendarButtonButtonChromeMargin}" RenderNormal="False" RenderSelected="{TemplateBinding IsSelected}" RenderFocused="{TemplateBinding IsFocused}" RenderHighlighted="{TemplateBinding IsMouseOver}" telerik:StyleManager.Theme="{StaticResource Theme}" Style="{StaticResource SelectionChromeTemplate}" FontWeight="Bold"/>
                                        <Border x:Name="TodayVisual" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="1" CornerRadius="2" Margin="{StaticResource CalendarButtonTodayVisualMargin}" Visibility="Collapsed"/>
                                        <ContentPresenter x:Name="Content" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                        <Setter Property="FontFamily" Value="Segoe UI"/>
                        <Setter Property="FontSize" Value="13.333"/>
                        <Setter Property="Foreground" Value="White"/>
                    </Style>
                    <SolidColorBrush x:Key="CalendarOuterBorder" Color="#00848484"/>
                    <Thickness x:Key="CalendarViewBorderThickness">1</Thickness>
                    <Thickness x:Key="CalendarViewHeaderPadding">3</Thickness>
                     
                    <Thickness x:Key="CalendarViewHeaderMargin">0 0 0 0</Thickness>
                     
                    <Thickness x:Key="CalendarWeekHeaderVerticalOuterBorderThickness">1</Thickness>
                    <Thickness x:Key="CalendarWeekHeaderVerticalOuterBorderMargin">0 0 -1 0</Thickness>
                    <telerik:InvertedBooleanToVisibilityConverter x:Key="InvertedBooleanToVisibilityConverterInstance"/>
                    <System:Int32 x:Key="CalendarWeekHeaderVerticalOuterBorderZIndex">0</System:Int32>
                     
                    <Thickness x:Key="CalendarWeekHeaderHorizontalOuterBorderThickness">1 0 1 1</Thickness>
                    <Thickness x:Key="CalendarWeekHeaderHorizontalOuterBorderMargin">0 0 0 0</Thickness>
                    <System:Int32 x:Key="CalendarWeekHeaderHorizontalOuterBorderZIndex">0</System:Int32>
                     
                    <Thickness x:Key="CalendarWeekHeaderVerticalInnerBorderThickness">1</Thickness>
                    <Thickness x:Key="CalendarWeekHeaderVerticalInnerBorderMargin">1 1 0 1</Thickness>
                    <System:Int32 x:Key="CalendarWeekHeaderVerticalInnerBorderZIndex">0</System:Int32>
                     
                    <Thickness x:Key="CalendarWeekHeaderHorizontalInnerBorderThickness">1</Thickness>
                    <Thickness x:Key="CalendarWeekHeaderHorizontalInnerBorderMargin">1 0 1 1</Thickness>
                    <System:Int32 x:Key="CalendarWeekHeaderHorizontalInnerBorderZIndex">0</System:Int32>
                     
                     
                    <Thickness x:Key="CalendarWeekHeaderVerticalBackgroundMargin">2 2 1 2</Thickness>
                    <System:Int32 x:Key="CalendarWeekHeaderVerticalBackgroundZIndex">0</System:Int32>
                     
                    <Thickness x:Key="CalendarWeekHeaderHorizontalBackgroundMargin">2 1 2 2</Thickness>
                    <System:Int32 x:Key="CalendarWeekHeaderHorizontalBackgroundZIndex">0</System:Int32>
                    <Thickness x:Key="CalendarItemsMargin">1 0 1 1</Thickness>
                    <Thickness x:Key="CalendarViewMargin">-1 -1 0 0</Thickness>
                    <Style x:Key="CalendarViewStyle1" TargetType="Telerik_Windows_Controls_Calendar:CalendarView">
                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                        <Setter Property="VerticalContentAlignment" Value="Center"/>
                        <Setter Property="BorderBrush" Value="{StaticResource TransparentBrush}"/>
                        <Setter Property="Background" Value="{StaticResource TransparentBrush}"/>
                        <Setter Property="BorderThickness" Value="{StaticResource CalendarViewBorderThickness}"/>
                        <Setter Property="Padding" Value="{StaticResource CalendarViewHeaderPadding}"/>
                        <Setter Property="IsTabStop" Value="False"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="Telerik_Windows_Controls_Calendar:CalendarView">
                                    <Grid Margin="{StaticResource CalendarViewMargin}">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"/>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <Border x:Name="BackgroundVisual" Background="{TemplateBinding Background}" Grid.RowSpan="2"/>
                                        <Border x:Name="Header" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{StaticResource TransparentBrush}" Margin="{StaticResource CalendarViewHeaderMargin}" Visibility="{TemplateBinding HeaderVisibility}">
                                            <Border BorderBrush="{StaticResource TransparentBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                                                <ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                            </Border>
                                        </Border>
                                        <Grid x:Name="WeekHeaders" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}" Grid.Row="1">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="7*"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="*"/>
                                                <RowDefinition Height="6*"/>
                                            </Grid.RowDefinitions>
                                            <Border x:Name="VerticalOuterBorder" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="{StaticResource CalendarWeekHeaderVerticalOuterBorderThickness}" Margin="{StaticResource CalendarWeekHeaderVerticalOuterBorderMargin}" Grid.RowSpan="2" Visibility="{Binding HideColumn, Converter={StaticResource InvertedBooleanToVisibilityConverterInstance}}" Canvas.ZIndex="{StaticResource CalendarWeekHeaderVerticalOuterBorderZIndex}"/>
                                            <Border x:Name="HorizontalOuterBorder" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="{StaticResource CalendarWeekHeaderHorizontalOuterBorderThickness}" Grid.ColumnSpan="2" Margin="{StaticResource CalendarWeekHeaderHorizontalOuterBorderMargin}" Visibility="{Binding HideRow, Converter={StaticResource InvertedBooleanToVisibilityConverterInstance}}" Canvas.ZIndex="{StaticResource CalendarWeekHeaderHorizontalOuterBorderZIndex}"/>
                                            <Border x:Name="VerticalInnerBorder" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="{StaticResource CalendarWeekHeaderVerticalInnerBorderThickness}" Margin="{StaticResource CalendarWeekHeaderVerticalInnerBorderMargin}" Grid.RowSpan="2" Visibility="{Binding HideColumn, Converter={StaticResource InvertedBooleanToVisibilityConverterInstance}}" Canvas.ZIndex="{StaticResource CalendarWeekHeaderVerticalInnerBorderZIndex}"/>
                                            <Border x:Name="HorizontalInnerBorder" BorderBrush="{StaticResource TransparentBrush}" BorderThickness="{StaticResource CalendarWeekHeaderHorizontalInnerBorderThickness}" Grid.ColumnSpan="2" Margin="{StaticResource CalendarWeekHeaderHorizontalInnerBorderMargin}" Visibility="{Binding HideRow, Converter={StaticResource InvertedBooleanToVisibilityConverterInstance}}" Canvas.ZIndex="{StaticResource CalendarWeekHeaderHorizontalInnerBorderZIndex}"/>
                                            <Rectangle x:Name="VerticalBackground" Fill="{StaticResource TransparentBrush}" Margin="{StaticResource CalendarWeekHeaderVerticalBackgroundMargin}" Grid.RowSpan="2" Visibility="{Binding HideColumn, Converter={StaticResource InvertedBooleanToVisibilityConverterInstance}}" Canvas.ZIndex="{StaticResource CalendarWeekHeaderVerticalBackgroundZIndex}"/>
                                            <Rectangle x:Name="HorizontalBackground" Grid.ColumnSpan="2" Fill="{StaticResource TransparentBrush}" Margin="{StaticResource CalendarWeekHeaderHorizontalBackgroundMargin}" Visibility="{Binding HideRow, Converter={StaticResource InvertedBooleanToVisibilityConverterInstance}}" Canvas.ZIndex="{StaticResource CalendarWeekHeaderHorizontalBackgroundZIndex}"/>
                                        </Grid>
                                        <ItemsPresenter Margin="{StaticResource CalendarItemsMargin}" Grid.Row="1"/>
                                        <Border x:Name="BorderBrush" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.RowSpan="2"/>
                                        <Rectangle x:Name="MinDesiredSize" Height="155" Grid.Row="1" Width="240"/>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                        <Setter Property="Margin" Value="0"/>
                    </Style>
                </telerik:RadCalendar.Resources>
                <telerik:RadCalendar.Background>
                    <StaticResource ResourceKey="ControlOuterBorder_Highlighted"/>
                </telerik:RadCalendar.Background>
                <telerik:RadCalendar.MonthViewStyle>
                    <StaticResource ResourceKey="CalendarViewStyle1"/>
                </telerik:RadCalendar.MonthViewStyle>
                <telerik:RadCalendar.DayButtonStyle>
                    <StaticResource ResourceKey="DayButtonStyle"/>
                </telerik:RadCalendar.DayButtonStyle>
                 
            </telerik:RadCalendar>
     
            <telerik:RadGridView x:Name="gridItemView" gvp:RadGridViewProperties.EmptyText="There are no events in the calendar for this month." HorizontalAlignment="Left" Margin="5,320,0,0" VerticalAlignment="Top" AlternateRowBackground="{x:Null}" AutoGenerateColumns="False" BorderThickness="0" CanUserDeleteRows="False" CanUserFreezeColumns="False" CanUserInsertRows="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False" EnableColumnVirtualization="False" EnableRowVirtualization="False" GridLinesVisibility="None" IsFilteringAllowed="False" IsReadOnly="True" SelectionUnit="FullRow" ShowColumnHeaders="False" ShowGroupPanel="False" VerticalGridLinesBrush="{x:Null}" RowIndicatorVisibility="Collapsed" Height="200" Width="380" RowLoaded="gridItemView_RowLoaded" Grid.RowSpan="2" SelectionChanged="gridItemView_SelectionChanged">
                <telerik:RadGridView.Resources>
                    <SolidColorBrush x:Key="ItemOuterBorder_Over" Color="#FFFFC92B"/>
                    <SolidColorBrush x:Key="ItemInnerBorder_Over" Color="White"/>
                    <LinearGradientBrush x:Key="ItemBackground_Over" EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFFFFBA3" Offset="1"/>
                        <GradientStop Color="#FFFFFBDA" Offset="0"/>
                    </LinearGradientBrush>
                    <SolidColorBrush x:Key="ItemOuterBorder_Selected" Color="#FFFFC92B"/>
                    <SolidColorBrush x:Key="ItemInnerBorder_Selected" Color="White"/>
                    <LinearGradientBrush x:Key="ItemBackground_Selected" EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFFCE79F" Offset="1"/>
                        <GradientStop Color="#FFFDD3A8"/>
                    </LinearGradientBrush>
                    <SolidColorBrush x:Key="ItemOuterBorder_Invalid" Color="#FFCE7D7D"/>
                    <LinearGradientBrush x:Key="ItemInnerBorder_Invalid" EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFEBF4FD"/>
                        <GradientStop Color="#FFDBEAFD" Offset="1"/>
                    </LinearGradientBrush>
                    <LinearGradientBrush x:Key="ItemBackground_Invalid" EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFFCDCDC"/>
                        <GradientStop Color="#FFFCC1C1" Offset="1"/>
                    </LinearGradientBrush>
                    <telerik:BooleanToOpacityConverter x:Key="BooleanToOpacityConverter"/>
                    <telerik:Office_BlackTheme x:Key="Theme"/>
                    <telerik:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
                    <telerik:GridLineWidthToThicknessConverter x:Key="GridLineWidthToThicknessConverter"/>
                    <SolidColorBrush x:Key="ControlOuterBorder" Color="#FF848484"/>
                    <SolidColorBrush x:Key="GridView_HierarchyBackground" Color="#FFBBBBBB"/>
                    <SolidColorBrush x:Key="ControlInnerBorder" Color="White"/>
                    <SolidColorBrush x:Key="GridView_RowIndicatorCellBackground" Color="#FFE4E4E4"/>
                    <SolidColorBrush x:Key="GridView_NavigatorIndicatorBackground" Color="#FF848484"/>
                    <SolidColorBrush x:Key="GridView_EditIndicatorBackground1" Color="#7F848484"/>
                    <SolidColorBrush x:Key="GridView_EditIndicatorBackground2" Color="#FFCBCBCB"/>
                    <SolidColorBrush x:Key="GridView_EditIndicatorBackground3" Color="#FF848484"/>
                    <SolidColorBrush x:Key="GridView_EditIndicatorBackground4" Color="White"/>
                    <LinearGradientBrush x:Key="GridView_ErrorIndicatorBackground1" EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFFC9999" Offset="0"/>
                        <GradientStop Color="#FFC26666" Offset="1"/>
                    </LinearGradientBrush>
                    <SolidColorBrush x:Key="GridView_ErrorIndicatorBackground2" Color="White"/>
                    <LinearGradientBrush x:Key="GridView_ErrorIndicatorBackground3" EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="Red" Offset="0"/>
                        <GradientStop Color="#FF990000" Offset="1"/>
                    </LinearGradientBrush>
                     
                    <ControlTemplate x:Key="GridViewRowTemplate" TargetType="telerik:GridViewRow">
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Unfocused"/>
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="NavigatorIndicator">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="SelectionStates">
                                    <VisualState x:Name="Unselected"/>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Background_Over">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Selected">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Background_Selected">
                                                <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="NavigatorIndicatorBackground">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource TransparentBrush}"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="ValueStates">
                                    <VisualState x:Name="Valid"/>
                                    <VisualState x:Name="Invalid">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Background_Invalid">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ErrorIndicator">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="EditIndicator">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="NavigatorIndicator">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Collapsed"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="EditStates">
                                    <VisualState x:Name="ReadOnlyMode"/>
                                    <VisualState x:Name="EditMode">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="EditIndicator">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="NavigatorIndicator">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Visible"/>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <telerik:SelectiveScrollingGrid x:Name="grid">
                                <telerik:SelectiveScrollingGrid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </telerik:SelectiveScrollingGrid.ColumnDefinitions>
                                <telerik:SelectiveScrollingGrid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>
                                </telerik:SelectiveScrollingGrid.RowDefinitions>
                                <Border x:Name="SelectionBackground" Background="{TemplateBinding Background}" Grid.ColumnSpan="2" Grid.Column="2" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" Margin="{TemplateBinding Margin}" MinWidth="{Binding RenderWidth, RelativeSource={RelativeSource TemplatedParent}}" Padding="{TemplateBinding Padding}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                <Border x:Name="Background_Over" BorderBrush="{StaticResource ItemOuterBorder_Over}" BorderThickness="1" Grid.ColumnSpan="2" Grid.Column="2" CornerRadius="1" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" Margin="1,1,1,2" MinWidth="{Binding RenderWidth, RelativeSource={RelativeSource TemplatedParent}}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="Collapsed">
                                    <Border BorderBrush="{StaticResource ItemInnerBorder_Over}" BorderThickness="1" Background="{StaticResource PurpleBrush}"/>
                                </Border>
                                <Border x:Name="Background_Selected" BorderBrush="{StaticResource ItemOuterBorder_Selected}" BorderThickness="1" Grid.ColumnSpan="2" Grid.Column="2" CornerRadius="1" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" Margin="1,1,1,2" MinWidth="{Binding RenderWidth, RelativeSource={RelativeSource TemplatedParent}}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="Collapsed">
                                    <Border BorderBrush="{StaticResource ItemInnerBorder_Selected}" BorderThickness="1" Background="{StaticResource PurpleBrush}"/>
                                </Border>
                                <Border x:Name="Background_Invalid" BorderBrush="{StaticResource ItemOuterBorder_Invalid}" BorderThickness="1" Grid.ColumnSpan="2" Grid.Column="2" CornerRadius="1" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" Margin="1,1,1,2" MinWidth="{Binding RenderWidth, RelativeSource={RelativeSource TemplatedParent}}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="Collapsed">
                                    <Border BorderBrush="{StaticResource ItemInnerBorder_Invalid}" BorderThickness="1" Background="{StaticResource PurpleBrush}"/>
                                </Border>
                                <telerik:GridViewToggleButton x:Name="PART_HierarchyExpandButton" Grid.Column="2" IsHitTestVisible="{Binding IsExpandable, RelativeSource={RelativeSource TemplatedParent}}" IsTabStop="{TemplateBinding IsTabStop}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Opacity="{Binding IsExpandable, Converter={StaticResource BooleanToOpacityConverter}, RelativeSource={RelativeSource TemplatedParent}}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="{Binding HasHierarchy, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}" Width="25"/>
                                <Border Grid.Column="2" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding HasHierarchy, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}"/>
                                <telerik:DataCellsPresenter x:Name="PART_DataCellsPresenter" Grid.Column="3" telerik:StyleManager.Theme="{StaticResource Theme}"/>
                                <Border x:Name="PART_RowBorder" BorderBrush="{TemplateBinding HorizontalGridLinesBrush}" BorderThickness="{Binding HorizontalGridLinesWidth, ConverterParameter=Bottom, Converter={StaticResource GridLineWidthToThicknessConverter}, RelativeSource={RelativeSource TemplatedParent}}" Grid.ColumnSpan="4" Grid.Column="1" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" MinWidth="{Binding RenderWidth, RelativeSource={RelativeSource TemplatedParent}}" Grid.RowSpan="4" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" VerticalAlignment="Bottom"/>
                                <Border BorderBrush="{StaticResource ControlOuterBorder}" BorderThickness="0,1" Background="{StaticResource GridView_HierarchyBackground}" Grid.ColumnSpan="2" Grid.Column="2" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" MaxWidth="30000" Padding="6" Grid.Row="2" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True" Visibility="{Binding IsExpanded, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}">
                                    <ContentPresenter x:Name="PART_HierarchyChildPresenter" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True"/>
                                </Border>
                                <telerik:DetailsPresenter x:Name="PART_DetailsPresenter" Grid.ColumnSpan="2" Grid.Column="2" DetailsProvider="{TemplateBinding DetailsProvider}" HorizontalAlignment="{Binding RenderHorizontalAlignment, RelativeSource={RelativeSource TemplatedParent}}" MaxWidth="30000" Grid.Row="1" telerik:StyleManager.Theme="{StaticResource Theme}"/>
                                <telerik:IndentPresenter x:Name="PART_IndentPresenter" Grid.Column="1" IndentLevel="{TemplateBinding IndentLevel}" Grid.RowSpan="4" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" telerik:StyleManager.Theme="{StaticResource Theme}"/>
                                <Border x:Name="PART_IndicatorPresenter" BorderBrush="{StaticResource ControlOuterBorder}" BorderThickness="0,0,1,1" Grid.Column="0" Grid.RowSpan="3" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{TemplateBinding RowIndicatorVisibility}" VerticalAlignment="Stretch" Width="25">
                                    <Border x:Name="NavigatorIndicatorBackground" BorderBrush="{StaticResource ControlInnerBorder}" BorderThickness="1" Background="{StaticResource GridView_RowIndicatorCellBackground}">
                                        <Grid>
                                            <Grid x:Name="NavigatorIndicator" HorizontalAlignment="Center" Height="11" Visibility="Collapsed" VerticalAlignment="Center" Width="11">
                                                <Path Data="F1 M 32.0234,6.66669L 24.2923,0.0248413L 28.3697,0.0248413L 32,3.14362L 36.1492,6.70819L 32,10.2728L 28.4664,13.3085L 24.2923,13.3085L 32.0234,6.66669 Z " Fill="{StaticResource GridView_NavigatorIndicatorBackground}" HorizontalAlignment="Center" Height="8" Margin="0" Stretch="Fill" VerticalAlignment="Center" Width="8"/>
                                            </Grid>
                                            <Grid x:Name="EditIndicator" HorizontalAlignment="Center" Height="10" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
                                                <Path Data="M14,9 L15,9 15,10 14,10 z M1,9 L2,9 2,10 1,10 z M15,8 L16,8 16,9 15,9 z M0,8 L1,8 1,9 0,9 z M15,1 L16,1 16,2 15,2 z M0,1 L1,1 1,2 0,2 z M14,0 L15,0 15,1 14,1 z M1,0 L2,0 2,1 1,1 z" Fill="{StaticResource GridView_EditIndicatorBackground1}" Stretch="Fill"/>
                                                <Path Data="M0.99999994,6.9999995 L2,6.9999995 3,6.9999995 4,6.9999995 5,6.9999995 6,6.9999995 7,6.9999995 8,6.9999995 9,6.9999995 10,6.9999995 11,6.9999995 12,6.9999995 13,6.9999995 13,7.9999995 12,7.9999995 11,7.9999995 10,7.9999995 9,7.9999995 8,7.9999995 7,7.9999995 6,7.9999995 5,7.9999995 4,7.9999995 3,7.9999995 2,7.9999995 0.99999994,7.9999995 z M13,0.99999994 L14,0.99999994 14,1.9999999 14,2.9999995 14,3.9999995 14,4.9999995 14,5.9999995 14,6.9999995 13,6.9999995 13,5.9999995 13,4.9999995 13,3.9999995 13,2.9999995 13,1.9999999 z M0,0.99999994 L0.99999994,0.99999994 0.99999994,1.9999999 0.99999994,2.9999995 0.99999994,3.9999995 0.99999994,4.9999995 0.99999994,5.9999995 0.99999994,6.9999995 0,6.9999995 0,5.9999995 0,4.9999995 0,3.9999995 0,2.9999995 0,1.9999999 z M11,0 L12,0 13,0 13,0.99999994 12,0.99999994 11,0.99999994 10,0.99999994 9,0.99999994 8,0.99999994 7,0.99999994 6,0.99999994 5,0.99999994 4,0.99999994 3,0.99999994 2,0.99999994 0.99999994,0.99999994 0.99999994,2.3841858E-07 2,2.3841858E-07 3,2.3841858E-07 4,2.3841858E-07 5,2.3841858E-07 6,2.3841858E-07 7,2.3841858E-07 8,2.3841858E-07 9,2.3841858E-07 10,2.3841858E-07 z" Fill="{StaticResource GridView_EditIndicatorBackground2}" Margin="1" Stretch="Fill"/>
                                                <Path Data="M2,9 L3,9 4,9 5,9 6,9 7,9 8,9 9,9 10,9 11,9 12,9 13,9 14,9 14,10 13,10 12,10 11,10 10,10 9,10 8,10 7,10 6,10 5,10 4,10 3,10 2,10 z M14,8 L15,8 15,9 14,9 z M1,8 L2,8 2,9 1,9 z M15,2 L16,2 16,3 16,4 16,5 16,6 16,7 16,8 15,8 15,7 15,6 15,5 15,4 15,3 z M3,2 L4,2 5,2 6,2 6,3 5,3 5,4 5,5 5,6 5,7 6,7 6,8 5,8 4,8 3,8 3,7 4,7 4,6 4,5 4,4 4,3 3,3 z M0,2 L1,2 1,3 1,4 1,5 1,6 1,7 1,8 0,8 0,7 0,6 0,5 0,4 0,3 z M14,1 L15,1 15,2 14,2 z M1,1 L2,1 2,2 1,2 z M2,0 L3,0 4,0 5,0 6,0 7,0 8,0 9,0 10,0 11,0 12,0 13,0 14,0 14,1 13,1 12,1 11,1 10,1 9,1 8,1 7,1 6,1 5,1 4,1 3,1 2,1 z" Fill="{StaticResource GridView_EditIndicatorBackground3}" Stretch="Fill"/>
                                                <Path Data="M4,0 L5,0 6,0 7,0 8,0 9,0 10,0 11,0 12,0 12,1 12,2 12,3 12,4 12,5.0000001 12,6 11,6 10,6 9,6 8,6 7,6 6,6 5,6 4,6 4,5.0000001 3,5.0000001 3,4 3,3 3,2 3,1 4,1 z M0,0 L1,0 1,1 2,1 2,2 2,3 2,4 2,5.0000001 1,5.0000001 1,6 0,6 0,5.0000001 0,4 0,3 0,2 0,1 z" Fill="{StaticResource GridView_EditIndicatorBackground4}" Margin="2" Stretch="Fill"/>
                                            </Grid>
                                            <Grid x:Name="ErrorIndicator" HorizontalAlignment="Center" Height="16" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
                                                <Path Data="M3,12.999999 L4,12.999999 5,12.999999 6,12.999999 7,12.999999 8,12.999999 9,12.999999 10,12.999999 11,12.999999 11,13.999999 10,13.999999 9,13.999999 8,13.999999 7,13.999999 6,13.999999 5,13.999999 4,13.999999 3,13.999999 z M11,11.999999 L12,11.999999 12,12.999999 11,12.999999 z M2.0000001,11.999999 L3,11.999999 3,12.999999 2.0000001,12.999999 z M12,10.999999 L13,10.999999 13,11.999999 12,11.999999 z M1,10.999999 L2.0000001,10.999999 2.0000001,11.999999 1,11.999999 z M13,2.9999992 L14,2.9999992 14,3.9999992 14,4.9999992 14,5.9999992 14,6.9999992 14,7.9999992 14,8.9999992 14,9.9999992 14,10.999999 13,10.999999 13,9.9999992 13,8.9999992 13,7.9999992 13,6.9999992 13,5.9999992 13,4.9999992 13,3.9999992 z M0,2.9999992 L1,2.9999992 1,3.9999992 1,4.9999992 1,5.9999992 1,6.9999992 1,7.9999992 1,8.9999992 1,9.9999992 1,10.999999 0,10.999999 0,9.9999992 0,8.9999992 0,7.9999992 0,6.9999992 0,5.9999992 0,4.9999992 0,3.9999992 z M12,1.9999999 L13,1.9999999 13,2.9999992 12,2.9999992 z M1,1.9999999 L2.0000001,1.9999999 2.0000001,2.9999992 1,2.9999992 z M11,0.99999994 L12,0.99999994 12,1.9999999 11,1.9999999 z M2.0000001,0.99999994 L2.9999998,0.99999994 2.9999998,1.9999999 2.0000001,1.9999999 z M2.9999998,0 L3.9999998,0 5,0 6,0 7,0 8,0 9,0 10,0 11,0 11,0.99999994 10,0.99999994 9,0.99999994 8,0.99999994 7,0.99999994 6,0.99999994 5,0.99999994 3.9999998,0.99999994 2.9999998,0.99999994 z" Fill="{StaticResource GridView_ErrorIndicatorBackground1}" Margin="1" Stretch="Fill"/>
                                                <Path Data="M1.4901161E-07,8 L1.0000001,8 2.0000002,8 2.0000002,9 2.0000002,10 1.0000003,10 1.0000003,9 1.0000001,10 1.4901161E-07,10 1.4901161E-07,9 z M1.4901161E-07,0 L1.0000001,0 2.0000002,0 2.0000002,1 2.0000002,2 2.0000002,3 2.0000002,4.0000001 2.0000002,5 2.0000002,5.9999999 2.0000002,7 1.0000001,7 1.4901161E-07,7 1.4901161E-07,5.9999999 1.4901161E-07,5 1.4901161E-07,4.0000001 1.4901161E-07,3 1.4901161E-07,2 0,1 z" Fill="{StaticResource GridView_ErrorIndicatorBackground2}" Margin="7,3" Stretch="Fill"/>
                                                <Path Data="M4,15 L5,15 6,15 7,15 8,15 9,15 10,15 11,15 12,15 12,16 11,16 10,16 9,16 8,16 7,16 6,16 5,16 4,16 z M12,14 L13,14 13,15 12,15 z M3,14 L4,14 4,15 3,15 z M13,13 L14,13 14,14 13,14 z M2,13 L3,13 3,14 2,14 z M14,12 L15,12 15,13 14,13 z M1,12 L2,12 2,13 1,13 z M7,11 L7,12 7,13 8,13 9,13 9,12 9,11 8,11 z M15,4 L16,4 16,5 16,6 16,7 16,8 16,9 16,10 16,11 16,12 15,12 15,11 15,10 15,9 15,8 15,7 15,6 15,5 z M0,4 L1,4 1,5 1,6 1,7 1,8 1,9 1,10 1,11 1,12 0,12 0,11 0,10 0,9 0,8 0,7 0,6 0,5 z M14,3 L15,3 15,4 14,4 z M7,3 L7,4 7,5 7,6 7,7 7,8 7,9 7,10 8,10 9,10 9,9 9,8 9,7 9,6 9,5 9,4 9,3 8,3 z M1,3 L2,3 2,4 1,4 z M13,2 L14,2 14,3 13,3 z M4,2 L5,2 6,2 7,2 8,2 9,2 10,2 11,2 12,2 12,3 13,3 13,4 14,4 14,5 14,6 14,7 14,8 14,9 14,10 14,11 14,12 13,12 13,13 12,13 12,14 11,14 10,14 9,14 8,14 7,14 6,14 5,14 4,14 4,13 3,13 3,12 2,12 2,11 2,10 2,9 2,8 2,7 2,6 2,5 2,4 3,4 3,3 4,3 z M2,2 L3,2 3,3 2,3 z M12,1 L13,1 13,2 12,2 z M3,1 L4,1 4,2 3,2 z M4,0 L5,0 6,0 7,0 8,0 9,0 10,0 11,0 12,0 12,1 11,1 10,1 9,1 8,1 7,1 6,1 5,1 4,1 z" Fill="{StaticResource GridView_ErrorIndicatorBackground3}" Stretch="Fill"/>
                                            </Grid>
                                        </Grid>
                                    </Border>
                                </Border>
                            </telerik:SelectiveScrollingGrid>
                        </Border>
                    </ControlTemplate>
                    <SolidColorBrush x:Key="ItemBackground" Color="White"/>
                    <SolidColorBrush x:Key="GridView_GridLinesItemBorder" Color="#FFCBCBCB"/>
                    <Style x:Key="GridViewRowStyle1" TargetType="telerik:GridViewRow">
                        <Setter Property="IsTabStop" Value="False"/>
                        <Setter Property="Template" Value="{StaticResource GridViewRowTemplate}"/>
                        <Setter Property="Background" Value="{StaticResource ItemBackground}"/>
                        <Setter Property="BorderBrush" Value="{StaticResource GridView_GridLinesItemBorder}"/>
                        <Setter Property="BorderThickness" Value="0"/>
                        <Setter Property="FontWeight" Value="Normal"/>
                        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                        <Setter Property="Padding" Value="0"/>
                        <Setter Property="FontSize" Value="13.333"/>
                        <Setter Property="FontFamily" Value="Segoe UI"/>
                    </Style>
     
                    <DataTemplate x:Key="MyToolTip">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Description}" Foreground="Red" />
                        </StackPanel>
                    </DataTemplate>
                     
                </telerik:RadGridView.Resources>
                <telerik:RadGridView.RowStyle>
                    <StaticResource ResourceKey="GridViewRowStyle1"/>
                </telerik:RadGridView.RowStyle>
                <telerik:RadGridView.Columns>
                    <telerik:GridViewDataColumn IsFilterable="False" IsGroupable="False" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" ShowDistinctFilters="False" UniqueName="gridViewDate" DataMemberBinding="{Binding EventDate}"/>
                    <telerik:GridViewDataColumn IsFilterable="False" IsGroupable="False" IsReadOnly="True" IsReorderable="False" IsResizable="False" IsSortable="False" ShowDistinctFilters="False" UniqueName="gridViewTitle" DataMemberBinding="{Binding Title}"/>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
            <toolkit:BusyIndicator x:Name="busyIndicatorElement" IsBusy="false" BusyContent="Loading Data from SharePoint..." Margin="4,5,8,12" Height="504" VerticalAlignment="Center" Grid.RowSpan="2" />
        </Grid>
    </UserControl>
     
     
     
     
     
     
     
    **************************************************************************************
    ****************************************************************************************
    ***************************************************************************************
     
    AND THE .CS FILE
     
     
     
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
    using Microsoft.SharePoint.Client;
    using System.ComponentModel;
    using Telerik.Windows.Controls.GridView;
    using Telerik.Windows.Controls;
    using System.Windows.Browser;
     
    namespace SilverlightSharePointCalendar
    {
        public sealed partial class MainPage : UserControl, IDisposable
        {
            DateTime startDate;
            DateTime endDate;
            ClientContext clientContext;
            ListItemCollection listItems;
            List<CalendarEvent> events;
            List<Month> monthList;
            Month selectedMonth;
            bool isFirstLoad;
            Month previousMonth;
             
            public MainPage()
            {
                InitializeComponent();
     
                isFirstLoad = true;
     
                this.gridItemView.Columns[0].CellStyleSelector = new MyStyleSelector();
     
                events = new List<CalendarEvent>();    
                PopulateMonthList();
            }
     
            private void PopulateMonthList()
            {
                monthList = new List<Month>();
                monthList.Add(new Month { Name="January", Value=1, DaysInMonth=31});
                if(DateTime.IsLeapYear(DateTime.Now.Year))
                    monthList.Add(new Month { Name="February", Value=2, DaysInMonth=29});
                else
                    monthList.Add(new Month { Name = "February", Value = 2, DaysInMonth = 28 });
                    monthList.Add(new Month { Name="March", Value=3, DaysInMonth=31});
                    monthList.Add(new Month { Name="April", Value=4, DaysInMonth=30});
                    monthList.Add(new Month { Name="May", Value=5, DaysInMonth=31});
                    monthList.Add(new Month { Name="June", Value=6, DaysInMonth=30});
                    monthList.Add(new Month { Name="July", Value=7, DaysInMonth=31});
                    monthList.Add(new Month { Name="August", Value=8, DaysInMonth=31});
                    monthList.Add(new Month { Name="September", Value=9, DaysInMonth=30});
                    monthList.Add(new Month { Name="October", Value=10, DaysInMonth=31});
                    monthList.Add(new Month { Name="November", Value=11, DaysInMonth=30});
                    monthList.Add(new Month { Name="December", Value=12, DaysInMonth=31});
            }
     
            private void SetDateRange(int tmpMonth)
            {
                busyIndicatorElement.IsBusy = true;
     
                gridItemView.ItemsSource = null;
                events.Clear();
                calendar1.SelectedDates.Clear();
                calendar1.SelectedDate = null;
                 
                int tmpYear = DateTime.Now.Year;
     
                selectedMonth = monthList.Single(p => p.Value == tmpMonth);
     
                int startYear = tmpYear;
                int startMonth = tmpMonth;
                int endYear = tmpYear;
                int endMonth = tmpMonth;
     
                if (tmpMonth == 1)
                {
                    startMonth = 12;
                    startYear -= 1;
                }
                else
                    startMonth -= 1;
     
                if (tmpMonth == 12)
                {
                    endMonth = 1;
                    endYear += 1;
                }
                else
                    endMonth += 1;
     
                startDate = new DateTime(startYear, startMonth, DateTime.DaysInMonth(startYear, startMonth));
                endDate = new DateTime(endYear, endMonth, 1);
     
                gridMonthView.CurrentItem = selectedMonth;
                gridMonthView.SelectedItem = selectedMonth;
     
                DateTime displayDateStart = new DateTime(endDate.Year, selectedMonth.Value, 1);
                DateTime displayDateEnd = new DateTime(endDate.Year, selectedMonth.Value, selectedMonth.DaysInMonth);
     
                calendar1.SelectableDateStart = new DateTime(1000, 1, 1);
                calendar1.SelectableDateEnd = new DateTime(3000, 1, 1);
     
                calendar1.DisplayDateStart = new DateTime(1000, 1, 1);
                calendar1.DisplayDateEnd = new DateTime(3000, 1, 1);
     
                if (RadCalendar.IsDisplayDateValid(calendar1, (DateTime)displayDateStart))
                {
                    calendar1.DisplayDate = displayDateStart.AddDays(1);
     
                    calendar1.DisplayDateStart = displayDateStart;
                    calendar1.DisplayDateEnd = displayDateEnd;
                }
                 
                SetMonthViewTextFormat();
     
                ConnectToSP();
            }
     
            /// <summary>
            /// The call to connect to SharePoint portal site
            /// Replace http:// path with path to the sub site using the control
            /// </summary>
            private void ConnectToSP()    
            {
                // if testing code locally, comment out the following line, and remove
                // the comments from the line after that
                // You will also need to change the URL to match a SharePoint site that you are testing against
     
                //clientContext = ClientContext.Current;
                clientContext = new ClientContext("http://sharepoint/sites/ISSPortal/K4W");
                 
                clientContext.Load(clientContext.Web);
                clientContext.Load(clientContext.Web.Lists);
                clientContext.ExecuteQueryAsync(OnConnectSucceeded, OnConnectFailed);
            }
     
            /// <summary>
            /// After connected to Calendar list, this section defines the query to run
            /// and then executes the sync call
            /// </summary>
            private void OnConnectSucceeded(Object sender, ClientRequestSucceededEventArgs args) 
            {     
                List cal = clientContext.Web.Lists.GetByTitle("Calendar");
                 
                CamlQuery query = new CamlQuery();
                 
                query.ViewXml = @"<View>
                        <Query>
                            <Where>
                                <And>
                                    <Gt>
                                        <FieldRef Name='EventDate'/>
                                        <Value Type='DateTime'>" + startDate.ToString("s") + @"</Value>
                                    </Gt>
                                    <Lt>
                                        <FieldRef Name='EventDate'/>
                                        <Value Type='DateTime'>" + endDate.ToString("s") + @"</Value>
                                    </Lt>
                                </And>
                            </Where>
                            <OrderBy>
                                <FieldRef Name='EventDate' Ascending='True'/>
                            </OrderBy>
                        </Query>
                    </View>";
     
                  
                listItems = cal.GetItems(query);
                 
                clientContext.Load(listItems, li => li.Include(i => i["EventDate"], i => i["Title"], i => i["Description"]));
     
                clientContext.ExecuteQueryAsync(OnQuerySucceeded, OnQueryFailed);
            }     
             
            private void OnConnectFailed(object sender, ClientRequestFailedEventArgs args) 
            {     
                //Dispatcher.BeginInvoke(NotifyFailure); 
            }
     
            private void OnQuerySucceeded(object sender, ClientRequestSucceededEventArgs args)
            {
                Dispatcher.BeginInvoke(LoadData); 
            }
     
            private void OnQueryFailed(object sender, ClientRequestFailedEventArgs args)
            {
                //Dispatcher.BeginInvoke(NotifyFailure); 
            }
     
            /// <summary>
            /// Loads retrieved data called from OnConnectSucceeded
            ///
            /// </summary>
            private void LoadData()
            {
                try
                {
                    foreach (ListItem item in listItems)
                    {
                        DateTime eventDate = DateTime.Parse(item["EventDate"].ToString());
                        events.Add(new CalendarEvent()
                        {
                            EventDateString = eventDate.Month.ToString() + "/" + eventDate.Day.ToString(),
                            EventDate = eventDate,
                            Title = item["Title"].ToString(),
                            Description = item["Description"].ToString()
                        });
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Failed loading SharePoint Data", MessageBoxButton.OK);
                }
                 
                for (int i = 0; i < events.Count(); i++)
                {
                    calendar1.SelectedDates.Add(events[i].EventDate);               
                }
                
     
                if (events.Count == 0)
                    calendar1.SelectedDate = null;
                else
                    calendar1.SetValue(ForegroundProperty, (SolidColorBrush)Resources["PurpleBrush"]);
                //((Grid)VisualTreeHelper.GetChild(e.Cell, 0)).Background = new SolidColorBrush(Colors.Red);
                //this.calendar1.Columns[0].CellStyleSelector = new MyStyleSelector();
     
                gridItemView.ItemsSource = events;
                isFirstLoad = false;
     
                busyIndicatorElement.IsBusy = false;
            }
     
            private void gridMonthView_DataLoaded(object sender, EventArgs e)
            {
                gridMonthView.SelectedItem = selectedMonth;
            }
     
            private void gridMonthView_RowLoaded(object sender, RowLoadedEventArgs e)
            {
                if ((e.Row != null))// && !(e.Row is GridViewHeaderRow))
                {
                    GridViewCell cell = e.Row.Cells.Cast<GridViewCell>().FirstOrDefault(c => c.Column.UniqueName == "gridViewMonth");
                    if (e.Row.IsSelected)
                    {
                        var newValue = this.gridMonthView.ItemContainerGenerator.ContainerFromItem(e.Row.Item);
     
                        newValue.SetValue(ForegroundProperty, (SolidColorBrush)Resources["PurpleBrush"]); // new SolidColorBrush(Utilities.ColorFromStringEx("#542989")));// { Color = Color.FromArgb(100, 84, 41, 137) });
                        newValue.SetValue(FontWeightProperty, FontWeights.Bold);                   
                    }
                }
            }
     
            private void gridMonthView_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangeEventArgs e)
            {
                if (!busyIndicatorElement.IsBusy)
                {
                    calendar1.SelectableDateStart = new DateTime(1000, 1, 1);
                    calendar1.SelectableDateEnd = new DateTime(3000, 1, 1);
     
                    if (!isFirstLoad)
                        previousMonth = selectedMonth;
     
                    Month tmpMonth = e.AddedItems[0] as Month;
     
                    SetDateRange(tmpMonth.Value);
                }
            }
     
            private void SetMonthViewTextFormat()
            {
                foreach (var item in this.gridMonthView.Items)
                {
                    var oldValue = this.gridMonthView.ItemContainerGenerator.ContainerFromItem(item);
                    oldValue.SetValue(ForegroundProperty, (SolidColorBrush)Resources["DarkGrayBrush"]);  //Utilities.ColorFromStringEx("#676767")));// { Color = Colors.Black});//Color.FromArgb(100, 0, 0, 0) });
                    oldValue.SetValue(FontWeightProperty, FontWeights.Normal);
                }
                if (this.gridMonthView.SelectedItem != null)
                {
                    var newValue = this.gridMonthView.ItemContainerGenerator.ContainerFromItem(this.gridMonthView.SelectedItem);
     
                    newValue.SetValue(ForegroundProperty, (SolidColorBrush)Resources["PurpleBrush"]); // new SolidColorBrush(Utilities.ColorFromStringEx("#542989")));// { Color = Color.FromArgb(100, 84, 41, 137) });
                    newValue.SetValue(FontWeightProperty, FontWeights.Bold);
                }
            }
     
            private void gridItemView_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
            {
                var row = e.Row as GridViewRow;
                if (row != null)
                {
                    CalendarEvent item = (CalendarEvent)row.DataContext;
     
                    ToolTip toolTip = new ToolTip()
                    {
                        Content = item.Description.ToString(),
                        ContentTemplate = (DataTemplate)this.LayoutRoot.Resources["MyToolTip"]
                    };
                    ToolTipService.SetToolTip(row, toolTip);
                }
     
     
                if ((e.Row != null) && !(e.Row is GridViewHeaderRow))
                {
                    GridViewCell dateCell = e.Row.Cells.Cast<GridViewCell>().FirstOrDefault(c => c.Column.UniqueName == "gridViewDate");
                    GridViewCell titleCell = e.Row.Cells.Cast<GridViewCell>().FirstOrDefault(c => c.Column.UniqueName == "gridViewTitle");
     
                    if (dateCell != null)
                    {
                        dateCell.Foreground = new SolidColorBrush(Utilities.ColorFromStringEx("#676767"));
                    }
     
                    if (titleCell != null)
                    {
                        titleCell.Foreground = new SolidColorBrush(Utilities.ColorFromStringEx("#542989"));
                    }
                }
            }
     
            private void UserControl_Loaded(object sender, RoutedEventArgs e)
            {
                selectedMonth = monthList.Single(p => p.Value == DateTime.Now.Month);
     
                gridMonthView.ItemsSource = monthList;
                gridMonthView.SelectedItem = selectedMonth;
     
                SetDateRange(selectedMonth.Value);
            }
     
            public void Dispose()
            {
                clientContext.Dispose();
            }
     
            private void gridItemView_SelectionChanged(object sender, SelectionChangeEventArgs e)
            {
                ScriptObject script = (ScriptObject)HtmlPage.Window.GetProperty("ShowCalendarItem");
     
                if(script!=null)
                    script.InvokeSelf("http://sharepoint/sites/ISSPortal/K4W/Lists/Calendar/DispForm.aspx?ID=" + 2);
            }
        }
     
        public class MyStyleSelector : Telerik.Windows.Controls.StyleSelector
        {
            public override Style SelectStyle(object item, DependencyObject container)
            {
                GridViewCell cell = container as GridViewCell;
                var style = base.SelectStyle(item, container);
     
                if (cell != null)
                {
                    if (item != null)
                    {
                        if ((item as GridViewCell).HasChanged) //condition for template applying
                        {
                            style = App.Current.Resources["fff"] as Style;
                        }
                    }
                }
                return style;
            }
        }
    }

Back to Top