TasksByUserControl.xaml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <UserControl x:Class="PRSDesktop.TasksByUserControl"
  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:dynamicgrid="clr-namespace:InABox.DynamicGrid;assembly=InABox.Wpf"
  7. xmlns:wpf="clr-namespace:InABox.Wpf;assembly=InABox.Wpf"
  8. xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
  9. xmlns:kanban="clr-namespace:Syncfusion.UI.Xaml.Kanban;assembly=Syncfusion.SfKanban.WPF"
  10. xmlns:local="clr-namespace:PRSDesktop"
  11. d:DataContext="{d:DesignInstance Type=local:TasksByStatusControl}"
  12. mc:Ignorable="d"
  13. x:Name="Control"
  14. d:DesignHeight="450" d:DesignWidth="800">
  15. <UserControl.Resources>
  16. <ResourceDictionary>
  17. <ResourceDictionary.MergedDictionaries>
  18. <ResourceDictionary Source="KanbanResources.xaml"/>
  19. </ResourceDictionary.MergedDictionaries>
  20. </ResourceDictionary>
  21. </UserControl.Resources>
  22. <UserControl.CommandBindings>
  23. <CommandBinding Command="{x:Static local:KanbanResources.EditTask}"
  24. Executed="EditTask_Executed"
  25. CanExecute="CommandBinding_CanExecute"/>
  26. <CommandBinding Command="{x:Static local:KanbanResources.OpenTaskMenu}"
  27. Executed="OpenTaskMenu_Executed"
  28. CanExecute="CommandBinding_CanExecute"/>
  29. <CommandBinding Command="{x:Static local:KanbanResources.SelectTask}"
  30. Executed="SelectTask_Executed"
  31. CanExecute="CommandBinding_CanExecute"/>
  32. </UserControl.CommandBindings>
  33. <dynamicgrid:DynamicSplitPanel x:Name="SplitPanel" View="Combined" AnchorWidth="100" AllowableViews="Combined"
  34. OnChanged="SplitPanel_OnChanged"
  35. DataContext="{Binding ElementName=Control}">
  36. <dynamicgrid:DynamicSplitPanel.Master>
  37. <Grid x:Name="EmployeeGrid" Margin="0" Grid.Column="1" Grid.Row="0">
  38. <Grid.RowDefinitions>
  39. <RowDefinition Height="Auto" />
  40. <RowDefinition x:Name="TeamsRow" Height="200" />
  41. <RowDefinition x:Name="SplitterRow" Height="4" />
  42. <RowDefinition Height="Auto" />
  43. <RowDefinition Height="*" />
  44. </Grid.RowDefinitions>
  45. <Grid.ColumnDefinitions>
  46. <ColumnDefinition Width="*" />
  47. </Grid.ColumnDefinitions>
  48. <Border
  49. Grid.Row="0"
  50. BorderBrush="Gray"
  51. BorderThickness="0.75,0.75,0.75,0"
  52. CornerRadius="5,5,0,0"
  53. Background="WhiteSmoke"
  54. Height="30">
  55. <Label Content="Teams" HorizontalContentAlignment="Center" FontWeight="Bold"
  56. VerticalContentAlignment="Center" />
  57. </Border>
  58. <syncfusion:CheckListBox
  59. Grid.Row="1"
  60. x:Name="SelectedTeams"
  61. DisplayMemberPath="Value"
  62. SelectedValuePath="Key"
  63. IsSelectAllEnabled="False"
  64. IsCheckOnFirstClick="True"
  65. Margin="0"
  66. ItemChecked="SelectedTeams_ItemChecked"
  67. SizeChanged="SelectedTeams_SizeChanged"
  68. VerticalAlignment="Stretch"
  69. BorderBrush="Gray"
  70. BorderThickness="0.75"
  71. Background="White" />
  72. <syncfusion:SfGridSplitter
  73. Grid.Row="2"
  74. x:Name="TeamSplitter"
  75. ResizeBehavior="PreviousAndNext"
  76. Height="4"
  77. HorizontalAlignment="Stretch"
  78. Background="Transparent"
  79. Template="{StaticResource HorizontalSplitter}"
  80. PreviewStyle="{StaticResource HorizontalSplitterPreview}" />
  81. <Border
  82. Grid.Row="3"
  83. BorderBrush="Gray"
  84. BorderThickness="0.75,0.75,0.75,0"
  85. CornerRadius="5,5,0,0"
  86. Background="WhiteSmoke"
  87. Height="30">
  88. <Label Content="Employees" HorizontalContentAlignment="Center" FontWeight="Bold"
  89. VerticalContentAlignment="Center" />
  90. </Border>
  91. <syncfusion:CheckListBox Grid.Row="4"
  92. x:Name="SelectedEmployees"
  93. DisplayMemberPath="Value.Name"
  94. SelectedValuePath="Key"
  95. IsCheckOnFirstClick="True"
  96. ItemChecked="SelectedEmployees_ItemChecked"
  97. IsSelectAllEnabled="False"
  98. Background="White"
  99. BorderBrush="Gray"
  100. BorderThickness="0.75"
  101. Margin="0" />
  102. </Grid>
  103. </dynamicgrid:DynamicSplitPanel.Master>
  104. <dynamicgrid:DynamicSplitPanel.Detail>
  105. <Grid>
  106. <Grid.RowDefinitions>
  107. <RowDefinition Height="Auto" />
  108. <RowDefinition Height="Auto" />
  109. <RowDefinition Height="*" />
  110. </Grid.RowDefinitions>
  111. <Border
  112. Background="WhiteSmoke"
  113. BorderThickness="0.75,0.75,0.75,0.75"
  114. BorderBrush="Gray"
  115. CornerRadius="5,5,0,0"
  116. Grid.Row="0"
  117. Padding="5">
  118. <DockPanel>
  119. <Label DockPanel.Dock="Left" Content="Search" Margin="5,0,0,0" />
  120. <Button DockPanel.Dock="Right" x:Name="Export" Padding="10,0" Margin="5,0,0,0" Content="Export"
  121. Click="Export_Click" />
  122. <CheckBox DockPanel.Dock="Right" x:Name="IncludeCompleted" Margin="10,0,5,0"
  123. Content="Include Completed" VerticalAlignment="Center" HorizontalAlignment="Right"
  124. Checked="IncludeCompleted_Checked" Unchecked="IncludeCompleted_Checked" />
  125. <CheckBox DockPanel.Dock="Right" x:Name="IncludeObserved" Margin="10,0,5,0"
  126. Content="Include Observing" VerticalAlignment="Center" HorizontalAlignment="Right"
  127. Checked="IncludeObserved_Checked" Unchecked="IncludeObserved_Checked" />
  128. <CheckBox DockPanel.Dock="Right" x:Name="IncludeManaged" Margin="10,0,5,0"
  129. Content="Include Managed" VerticalAlignment="Center" HorizontalAlignment="Right"
  130. Checked="IncludeManaged_Checked" Unchecked="IncludeManaged_Checked" />
  131. <ComboBox DockPanel.Dock="Right" x:Name="ViewType" Margin="5,0,0,0" Width="100"
  132. SelectedIndex="0" SelectionChanged="ViewType_SelectionChanged"
  133. VerticalContentAlignment="Center">
  134. <ComboBoxItem Content="Full" />
  135. <ComboBoxItem Content="Compact" />
  136. </ComboBox>
  137. <Label DockPanel.Dock="Right" x:Name="ViewTypeLabel" Content="View" Margin="5,0,0,0" />
  138. <ComboBox DockPanel.Dock="Right" x:Name="TaskType" Margin="5,0,0,0" Width="150"
  139. SelectedIndex="0" SelectionChanged="TaskType_SelectionChanged"
  140. VerticalContentAlignment="Center">
  141. </ComboBox>
  142. <Label DockPanel.Dock="Right" x:Name="TaskTypeLabel" Content="Type" Margin="5,0,0,0" />
  143. <TextBox DockPanel.Dock="Left" x:Name="Search" Margin="5,0,0,0" HorizontalAlignment="Stretch"
  144. VerticalContentAlignment="Center" KeyUp="Search_KeyUp" />
  145. </DockPanel>
  146. </Border>
  147. <ItemsControl Grid.Row="1" ItemsSource="{Binding Model.SectionHeaders}">
  148. <ItemsControl.ItemsPanel>
  149. <ItemsPanelTemplate>
  150. <UniformGrid Rows="1"/>
  151. </ItemsPanelTemplate>
  152. </ItemsControl.ItemsPanel>
  153. <ItemsControl.ItemTemplate>
  154. <DataTemplate DataType="local:TasksByUserEmployeeHeader">
  155. <Border BorderBrush="LightGray" BorderThickness="0,0,0,1">
  156. <Grid>
  157. <Grid.ColumnDefinitions>
  158. <ColumnDefinition Width="Auto" />
  159. <ColumnDefinition Width="*" />
  160. </Grid.ColumnDefinitions>
  161. <Grid.RowDefinitions>
  162. <RowDefinition Height="*" />
  163. <RowDefinition Height="*" />
  164. </Grid.RowDefinitions>
  165. <Border Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Width="40" Height="40" CornerRadius="20"
  166. Margin="5" BorderBrush="Gray" BorderThickness="0.75" VerticalAlignment="Center"
  167. HorizontalAlignment="Center">
  168. <Border.Background>
  169. <ImageBrush ImageSource="{Binding Image}"
  170. Stretch="UniformToFill"/>
  171. </Border.Background>
  172. </Border>
  173. <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Name}" FontSize="16" FontWeight="DemiBold"
  174. HorizontalAlignment="Left" Margin="10,0,10,0" />
  175. <TextBlock Grid.Column="1" Grid.Row="1" FontSize="12" HorizontalAlignment="Left" Margin="10,0,5,0">
  176. <Run Text="{Binding NumTasks,Mode=OneWay}" />
  177. <Run Text="Tasks /" />
  178. <Run Text="{Binding NumHours,Mode=OneWay, StringFormat={}{0:F2}}" />
  179. <Run Text="Hours" />
  180. </TextBlock>
  181. </Grid>
  182. </Border>
  183. </DataTemplate>
  184. </ItemsControl.ItemTemplate>
  185. </ItemsControl>
  186. <ScrollViewer Grid.Row="2">
  187. <ItemsControl ItemsSource="{Binding Path=Model.Categories}">
  188. <ItemsControl.ItemTemplate>
  189. <DataTemplate DataType="local:TasksByUserCategory">
  190. <Grid>
  191. <Grid.RowDefinitions>
  192. <RowDefinition Height="Auto"/>
  193. <RowDefinition>
  194. <RowDefinition.Style>
  195. <Style TargetType="RowDefinition">
  196. <Setter Property="Height" Value="0"/>
  197. <Style.Triggers>
  198. <DataTrigger Binding="{Binding Collapsed}" Value="False">
  199. <Setter Property="Height" Value="*"/>
  200. </DataTrigger>
  201. </Style.Triggers>
  202. </Style>
  203. </RowDefinition.Style>
  204. </RowDefinition>
  205. </Grid.RowDefinitions>
  206. <Grid.ColumnDefinitions>
  207. <ColumnDefinition Width="*"/>
  208. <ColumnDefinition Width="300"/>
  209. <ColumnDefinition Width="*"/>
  210. </Grid.ColumnDefinitions>
  211. <Rectangle Grid.Row="0" Grid.Column="0"
  212. HorizontalAlignment="Stretch"
  213. VerticalAlignment="Center"
  214. Fill="LightGray"
  215. Height="1"/>
  216. <Rectangle Grid.Row="0" Grid.Column="2"
  217. HorizontalAlignment="Stretch"
  218. VerticalAlignment="Center"
  219. Fill="LightGray"
  220. Height="1"/>
  221. <Button x:Name="FoldButton"
  222. Grid.Row="0"
  223. Grid.Column="1"
  224. Click="FoldButton_Click"
  225. Tag="{Binding}"
  226. Margin="5">
  227. <DockPanel>
  228. <Image Width="32" Height="32"
  229. RenderTransformOrigin="0.5,0.5" Source="pack://application:,,,/Resources/rightarrow.png"
  230. DockPanel.Dock="Left">
  231. <Image.Style>
  232. <Style TargetType="Image">
  233. <Style.Triggers>
  234. <DataTrigger Binding="{Binding Collapsed}" Value="False">
  235. <Setter Property="RenderTransform">
  236. <Setter.Value>
  237. <RotateTransform Angle="90"/>
  238. </Setter.Value>
  239. </Setter>
  240. </DataTrigger>
  241. </Style.Triggers>
  242. </Style>
  243. </Image.Style>
  244. </Image>
  245. <Label Content="{Binding Category}"
  246. VerticalContentAlignment="Center"
  247. HorizontalContentAlignment="Left"
  248. DockPanel.Dock="Right"/>
  249. </DockPanel>
  250. </Button>
  251. <Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3">
  252. <ItemsControl Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3"
  253. ItemsSource="{Binding EmployeeCategories}">
  254. <ItemsControl.ItemsPanel>
  255. <ItemsPanelTemplate>
  256. <UniformGrid Rows="1"/>
  257. </ItemsPanelTemplate>
  258. </ItemsControl.ItemsPanel>
  259. <ItemsControl.ItemTemplate>
  260. <DataTemplate DataType="local:TasksByUserEmployeeCategory">
  261. <Border BorderBrush="LightGray"
  262. BorderThickness="0,0,1,0"
  263. Padding="5,0">
  264. <Grid Tag="{Binding}"
  265. Background="Transparent"
  266. AllowDrop="True"
  267. DragOver="ItemsControl_DragOver"
  268. Drop="ItemsControl_Drop">
  269. <Grid.RowDefinitions>
  270. <RowDefinition Height="Auto"/>
  271. <RowDefinition Height="*"/>
  272. <RowDefinition>
  273. <RowDefinition.Style>
  274. <Style TargetType="{x:Type RowDefinition}">
  275. <Setter Property="Height" Value="75"/>
  276. <Style.Triggers>
  277. <DataTrigger Binding="{Binding Mode,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:TasksByUserControl}}}"
  278. Value="{x:Static local:KanbanViewMode.Compact}">
  279. <Setter Property="Height" Value="30"/>
  280. </DataTrigger>
  281. </Style.Triggers>
  282. </Style>
  283. </RowDefinition.Style>
  284. </RowDefinition>
  285. </Grid.RowDefinitions>
  286. <ItemsControl Grid.Row="0"
  287. ItemsSource="{Binding Tasks,Mode=OneWay}">
  288. <ItemsControl.Style>
  289. <Style TargetType="{x:Type ItemsControl}">
  290. <Setter Property="ItemTemplate" Value="{StaticResource FullKanban}"/>
  291. <Style.Triggers>
  292. <DataTrigger Binding="{Binding Mode,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:TasksByUserControl}}}"
  293. Value="{x:Static local:KanbanViewMode.Compact}">
  294. <Setter Property="ItemTemplate" Value="{StaticResource CompactKanban}"/>
  295. </DataTrigger>
  296. </Style.Triggers>
  297. </Style>
  298. </ItemsControl.Style>
  299. </ItemsControl>
  300. </Grid>
  301. </Border>
  302. </DataTemplate>
  303. </ItemsControl.ItemTemplate>
  304. </ItemsControl>
  305. </Border>
  306. </Grid>
  307. </DataTemplate>
  308. </ItemsControl.ItemTemplate>
  309. </ItemsControl>
  310. </ScrollViewer>
  311. </Grid>
  312. </dynamicgrid:DynamicSplitPanel.Detail>
  313. </dynamicgrid:DynamicSplitPanel>
  314. </UserControl>