<UserControl x:Class="Commands2.Views.Tasks"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
    xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" 
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid Margin="6">
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="2*"/>
        </Grid.ColumnDefinitions>
        <Border Style="{StaticResource OuterBorderStyle}" Margin="0,0,6,0">
            <telerikNavigation:RadTreeView x:Name="tvwCategories" ItemsSource="{Binding TaskCategories}" SelectedItem="{Binding SelectedTaskCategory, Mode=TwoWay}"/>
        </Border>
        <Controls:GridSplitter Width="6" Opacity="0"/>
        <Border Style="{StaticResource OuterBorderStyle}" Grid.Column="1">
            <Grid>
                <TextBlock Text="Please select a category." Visibility="{Binding ShowSelectMessage, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                <TextBlock Text="The selected category has no tasks." Visibility="{Binding ShowNoTasksMessage, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                <telerikGridView:RadGridView ItemsSource="{Binding Tasks}" SelectedItem="{Binding SelectedTask, Mode=TwoWay}" Visibility="{Binding ShowGridView, Converter={StaticResource BooleanToVisibilityConverter}}" AutoGenerateColumns="False">
                    <telerikGridView:RadGridView.Columns>
                        <telerikGridView:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}" Width="3*"/>
                        <telerikGridView:GridViewDataColumn Header="Description" DataMemberBinding="{Binding Description}" Width="*"/>
                        <telerikGridView:GridViewDataColumn Header="Due" DataMemberBinding="{Binding DueDate}" DataFormatString="{}{0:d}" Width="80"/>
                        <telerikGridView:GridViewDataColumn Header="Completed" DataMemberBinding="{Binding CompletionDate}" DataFormatString="{}{0:d}" Width="80"/>
                    </telerikGridView:RadGridView.Columns>
                    <telerikNavigation:RadContextMenu.ContextMenu>
                        <telerikNavigation:RadContextMenu Opened="GridContextMenuOpened">
                            <telerikNavigation:RadMenuItem Header="Move To">
                                <telerikNavigation:RadMenuItem Header="Inbox" Command="{Binding MoveToCommand}" CommandParameter="{Binding TaskCategoryInbox}" Visibility="{Binding IsMoveToInboxCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                <telerikNavigation:RadMenuItem Header="Actions" Command="{Binding MoveToCommand}" CommandParameter="{Binding TaskCategoryActions}" Visibility="{Binding IsMoveToActionsCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                <telerikNavigation:RadMenuItem Header="Waiting" Command="{Binding MoveToCommand}" CommandParameter="{Binding TaskCategoryWaiting}" Visibility="{Binding IsMoveToWaitingCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                <telerikNavigation:RadMenuItem Header="Someday" Command="{Binding MoveToCommand}" CommandParameter="{Binding TaskCategorySomeday}" Visibility="{Binding IsMoveToSomedayCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                <telerikNavigation:RadMenuItem Header="Ticklers" Command="{Binding MoveToCommand}" CommandParameter="{Binding TaskCategoryTicklers}" Visibility="{Binding IsMoveToTicklersCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                                <telerikNavigation:RadMenuItem Header="Reference" Command="{Binding MoveToCommand}" CommandParameter="{Binding TaskCategoryReference}" Visibility="{Binding IsMoveToReferenceCommandAvailable, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                            </telerikNavigation:RadMenuItem>
                        </telerikNavigation:RadContextMenu>
                    </telerikNavigation:RadContextMenu.ContextMenu>
                </telerikGridView:RadGridView>
            </Grid>
        </Border>
    </Grid>

</UserControl>
