TasksByStatusControl.xaml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <UserControl x:Class="PRSDesktop.TasksByStatusControl"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:PRSDesktop"
  7. mc:Ignorable="d"
  8. x:Name="Control"
  9. d:DesignHeight="450" d:DesignWidth="800">
  10. <UserControl.Resources>
  11. <ResourceDictionary>
  12. <ResourceDictionary.MergedDictionaries>
  13. <ResourceDictionary Source="KanbanResources.xaml"/>
  14. </ResourceDictionary.MergedDictionaries>
  15. </ResourceDictionary>
  16. </UserControl.Resources>
  17. <UserControl.CommandBindings>
  18. <CommandBinding Command="{x:Static local:KanbanResources.EditTask}"
  19. Executed="EditTask_Executed"
  20. CanExecute="CommandBinding_CanExecute"/>
  21. <CommandBinding Command="{x:Static local:KanbanResources.OpenTaskMenu}"
  22. Executed="OpenTaskMenu_Executed"
  23. CanExecute="CommandBinding_CanExecute"/>
  24. <CommandBinding Command="{x:Static local:KanbanResources.SelectTask}"
  25. Executed="SelectTask_Executed"
  26. CanExecute="CommandBinding_CanExecute"/>
  27. </UserControl.CommandBindings>
  28. <Grid x:Name="LayoutRoot">
  29. <Grid.ColumnDefinitions>
  30. <ColumnDefinition Width="Auto" x:Name="EmployeeListColumn" />
  31. <ColumnDefinition Width="*" />
  32. </Grid.ColumnDefinitions>
  33. <Grid.RowDefinitions>
  34. <RowDefinition Height="Auto" />
  35. <RowDefinition Height="*" />
  36. </Grid.RowDefinitions>
  37. <Border Grid.Row="0" Grid.Column="0" CornerRadius="5,5,0,0" BorderBrush="Gray" BorderThickness="0.75"
  38. Background="WhiteSmoke" Padding="5" Margin="0,0,4,2">
  39. <Label Content="Employee List" HorizontalContentAlignment="Center" />
  40. </Border>
  41. <ListView Grid.Column="0" Grid.Row="1" x:Name="EmployeeList" HorizontalAlignment="Stretch"
  42. SelectionChanged="Employees_SelectionChanged" Margin="0,0,4,0" Background="White" BorderBrush="Gray"
  43. BorderThickness="0.75">
  44. <ListView.ItemTemplate>
  45. <DataTemplate>
  46. <Grid HorizontalAlignment="Stretch" Margin="4,2,4,2">
  47. <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
  48. <Border Width="40" Height="40" CornerRadius="20" BorderBrush="Black" BorderThickness="1"
  49. VerticalAlignment="Center" HorizontalAlignment="Center">
  50. <Border.Background>
  51. <ImageBrush ImageSource="{Binding Path=Image}" Stretch="UniformToFill" />
  52. </Border.Background>
  53. </Border>
  54. <TextBlock x:Name="PCName" Height="Auto" TextWrapping="Wrap" Width="80" Margin="4,0,0,0"
  55. TextAlignment="Left" Text="{Binding Name}" VerticalAlignment="Center" />
  56. </StackPanel>
  57. </Grid>
  58. </DataTemplate>
  59. </ListView.ItemTemplate>
  60. </ListView>
  61. <Border Grid.Row="0" Grid.Column="1" CornerRadius="5,5,0,0" BorderBrush="Gray" BorderThickness="0.75"
  62. Background="WhiteSmoke" Padding="5" Margin="0,0,0,2">
  63. <DockPanel>
  64. <Button DockPanel.Dock="Left" x:Name="TaskTypesLabel" Content="Filter" Padding="4,0" Click="TaskTypesLabel_OnClick" />
  65. <ComboBox DockPanel.Dock="Left" x:Name="TaskTypes" Margin="5,0,0,0" Width="150" SelectedIndex="0"
  66. SelectionChanged="TaskTypes_SelectionChanged" VerticalContentAlignment="Center"
  67. SelectedValuePath="Key" DisplayMemberPath="Value" />
  68. <Button DockPanel.Dock="Left" x:Name="JobFilterBtn" Content="Filter Job" Padding="4,0" Margin="5,0,0,0" Click="JobFilterBtn_OnClick" />
  69. <Label DockPanel.Dock="Left" Content="Search" Margin="5,0,0,0" />
  70. <Button DockPanel.Dock="Right" x:Name="Export" Padding="10,0" Margin="5,0,0,0" Content="Export"
  71. Click="Export_Click" />
  72. <CheckBox DockPanel.Dock="Right" x:Name="IncludeCompleted" Margin="10,0,5,0"
  73. Content="Include Completed" VerticalAlignment="Center" HorizontalAlignment="Right"
  74. Checked="IncludeCompleted_Checked" Unchecked="IncludeCompleted_Checked" />
  75. <CheckBox DockPanel.Dock="Right" x:Name="IncludeObserved" Margin="10,0,5,0" Content="Include Observing"
  76. VerticalAlignment="Center" HorizontalAlignment="Right" Checked="IncludeObserved_Checked"
  77. Unchecked="IncludeObserved_Checked" />
  78. <CheckBox DockPanel.Dock="Right" x:Name="IncludeLocked" Margin="10,0,5,0" Content="Include Locked"
  79. VerticalAlignment="Center" HorizontalAlignment="Right" Checked="IncludeLocked_Checked"
  80. Unchecked="IncludeLocked_Checked" />
  81. <ComboBox DockPanel.Dock="Right" x:Name="ViewType" Margin="5,0,0,0" Width="100" SelectedIndex="0"
  82. SelectionChanged="ViewType_SelectionChanged" VerticalContentAlignment="Center">
  83. <ComboBoxItem Content="Full" />
  84. <ComboBoxItem Content="Compact" />
  85. </ComboBox>
  86. <Label DockPanel.Dock="Right" x:Name="ViewTypeLabel" Content="View" Margin="5,0,0,0" />
  87. <TextBox DockPanel.Dock="Left" x:Name="Search" Margin="5,0,0,0" HorizontalAlignment="Stretch"
  88. VerticalContentAlignment="Center" KeyUp="Search_KeyUp" />
  89. </DockPanel>
  90. </Border>
  91. <ItemsControl x:Name="ColumnsList" ItemsSource="{Binding ElementName=Control,Path=Columns}"
  92. Grid.Row="1" Grid.Column="1">
  93. <ItemsControl.ItemsPanel>
  94. <ItemsPanelTemplate>
  95. <UniformGrid Rows="1"/>
  96. </ItemsPanelTemplate>
  97. </ItemsControl.ItemsPanel>
  98. <ItemsControl.ItemTemplate>
  99. <DataTemplate>
  100. <Border BorderBrush="LightGray" BorderThickness="0.75,0,0,0">
  101. <Grid ContextMenuOpening="Column_ContextMenuOpening"
  102. Tag="{Binding}">
  103. <Grid.ContextMenu>
  104. <ContextMenu/>
  105. </Grid.ContextMenu>
  106. <Grid.RowDefinitions>
  107. <RowDefinition Height="Auto"/>
  108. <RowDefinition Height="*"/>
  109. </Grid.RowDefinitions>
  110. <Border BorderBrush="LightGray" BorderThickness="0,0,0,1" Margin="0,0,0,5">
  111. <StackPanel Orientation="Vertical"
  112. Grid.Row="0">
  113. <TextBlock Text="{Binding Title,Mode=OneWay}" FontSize="16" FontWeight="DemiBold" HorizontalAlignment="Left"
  114. Margin="10,0,10,0" />
  115. <TextBlock FontSize="12" HorizontalAlignment="Left" Margin="10,0,5,0">
  116. <Run Text="{Binding NumTasks,Mode=OneWay}" />
  117. <Run Text="Tasks /" />
  118. <Run Text="{Binding NumHours,Mode=OneWay, StringFormat={}{0:F2}}"/>
  119. <Run Text="Hours" />
  120. </TextBlock>
  121. </StackPanel>
  122. </Border>
  123. <ItemsControl Grid.Row="1" Margin="5,0"
  124. AllowDrop="True"
  125. DragOver="ItemsControl_DragOver"
  126. Drop="ItemsControl_Drop"
  127. Tag="{Binding}"
  128. ItemsSource="{Binding Tasks,Mode=OneWay}">
  129. <ItemsControl.Style>
  130. <Style TargetType="{x:Type ItemsControl}" BasedOn="{StaticResource VirtualisedItemsControlStyle}">
  131. <Setter Property="ItemTemplate" Value="{StaticResource FullKanban}"/>
  132. <Style.Triggers>
  133. <DataTrigger Binding="{Binding Mode,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:TasksByStatusControl}}}"
  134. Value="{x:Static local:KanbanViewMode.Compact}">
  135. <Setter Property="ItemTemplate" Value="{StaticResource CompactKanban}"/>
  136. </DataTrigger>
  137. </Style.Triggers>
  138. </Style>
  139. </ItemsControl.Style>
  140. </ItemsControl>
  141. </Grid>
  142. </Border>
  143. </DataTemplate>
  144. </ItemsControl.ItemTemplate>
  145. </ItemsControl>
  146. </Grid>
  147. </UserControl>