TasksByUserControl.xaml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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. <local:TaskPanelFilterButton DockPanel.Dock="Left"
  120. x:Name="FilterButton"
  121. OnFilterRefresh="TaskPanelFilterButton_OnFilterRefresh"/>
  122. <Label DockPanel.Dock="Left" Content="Search" Margin="5,0,0,0" />
  123. <Button DockPanel.Dock="Right" x:Name="Export" Padding="10,0" Margin="5,0,0,0" Content="Export"
  124. Click="Export_Click" />
  125. <CheckBox DockPanel.Dock="Right" x:Name="IncludeCompleted" Margin="10,0,5,0"
  126. Content="Include Completed" VerticalAlignment="Center" HorizontalAlignment="Right"
  127. Checked="IncludeCompleted_Checked" Unchecked="IncludeCompleted_Checked" />
  128. <CheckBox DockPanel.Dock="Right" x:Name="IncludeObserved" Margin="10,0,5,0"
  129. Content="Include Observing" VerticalAlignment="Center" HorizontalAlignment="Right"
  130. Checked="IncludeObserved_Checked" Unchecked="IncludeObserved_Checked" />
  131. <CheckBox DockPanel.Dock="Right" x:Name="IncludeManaged" Margin="10,0,5,0"
  132. Content="Include Managed" VerticalAlignment="Center" HorizontalAlignment="Right"
  133. Checked="IncludeManaged_Checked" Unchecked="IncludeManaged_Checked" />
  134. <ComboBox DockPanel.Dock="Right" x:Name="ViewType" Margin="5,0,0,0" Width="100"
  135. SelectedIndex="0" SelectionChanged="ViewType_SelectionChanged"
  136. VerticalContentAlignment="Center">
  137. <ComboBoxItem Content="Full" />
  138. <ComboBoxItem Content="Compact" />
  139. </ComboBox>
  140. <Label DockPanel.Dock="Right" x:Name="ViewTypeLabel" Content="View" Margin="5,0,0,0" />
  141. <ComboBox DockPanel.Dock="Right" x:Name="TaskType" Margin="5,0,0,0" Width="150"
  142. SelectedIndex="0" SelectionChanged="TaskType_SelectionChanged"
  143. VerticalContentAlignment="Center">
  144. </ComboBox>
  145. <Label DockPanel.Dock="Right" x:Name="TaskTypeLabel" Content="Type" Margin="5,0,0,0" />
  146. <TextBox DockPanel.Dock="Left" x:Name="Search" Margin="5,0,0,0" HorizontalAlignment="Stretch"
  147. VerticalContentAlignment="Center" KeyUp="Search_KeyUp" />
  148. </DockPanel>
  149. </Border>
  150. <ItemsControl Grid.Row="1" ItemsSource="{Binding Model.SectionHeaders}">
  151. <ItemsControl.ItemsPanel>
  152. <ItemsPanelTemplate>
  153. <UniformGrid Rows="1"/>
  154. </ItemsPanelTemplate>
  155. </ItemsControl.ItemsPanel>
  156. <ItemsControl.ItemTemplate>
  157. <DataTemplate DataType="local:TasksByUserEmployeeHeader">
  158. <Border BorderBrush="LightGray" BorderThickness="0,0,0,1">
  159. <Grid>
  160. <Grid.ColumnDefinitions>
  161. <ColumnDefinition Width="Auto" />
  162. <ColumnDefinition Width="*" />
  163. </Grid.ColumnDefinitions>
  164. <Grid.RowDefinitions>
  165. <RowDefinition Height="*" />
  166. <RowDefinition Height="*" />
  167. </Grid.RowDefinitions>
  168. <Border Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Width="40" Height="40" CornerRadius="20"
  169. Margin="5" BorderBrush="Gray" BorderThickness="0.75" VerticalAlignment="Center"
  170. HorizontalAlignment="Center">
  171. <Border.Background>
  172. <ImageBrush ImageSource="{Binding Image}"
  173. Stretch="UniformToFill"/>
  174. </Border.Background>
  175. </Border>
  176. <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Name}" FontSize="16" FontWeight="DemiBold"
  177. HorizontalAlignment="Left" Margin="10,0,10,0" />
  178. <TextBlock Grid.Column="1" Grid.Row="1" FontSize="12" HorizontalAlignment="Left" Margin="10,0,5,0">
  179. <Run Text="{Binding NumTasks,Mode=OneWay}" />
  180. <Run Text="Tasks /" />
  181. <Run Text="{Binding NumHours,Mode=OneWay, StringFormat={}{0:F2}}" />
  182. <Run Text="Hours" />
  183. </TextBlock>
  184. </Grid>
  185. </Border>
  186. </DataTemplate>
  187. </ItemsControl.ItemTemplate>
  188. </ItemsControl>
  189. <ScrollViewer Grid.Row="2">
  190. <ItemsControl ItemsSource="{Binding Path=Model.Categories}">
  191. <ItemsControl.ItemTemplate>
  192. <DataTemplate DataType="local:TasksByUserCategory">
  193. <Grid>
  194. <Grid.RowDefinitions>
  195. <RowDefinition Height="Auto"/>
  196. <RowDefinition>
  197. <RowDefinition.Style>
  198. <Style TargetType="RowDefinition">
  199. <Setter Property="Height" Value="0"/>
  200. <Style.Triggers>
  201. <DataTrigger Binding="{Binding Collapsed}" Value="False">
  202. <Setter Property="Height" Value="*"/>
  203. </DataTrigger>
  204. </Style.Triggers>
  205. </Style>
  206. </RowDefinition.Style>
  207. </RowDefinition>
  208. </Grid.RowDefinitions>
  209. <Grid.ColumnDefinitions>
  210. <ColumnDefinition Width="*"/>
  211. <ColumnDefinition Width="300"/>
  212. <ColumnDefinition Width="*"/>
  213. </Grid.ColumnDefinitions>
  214. <Rectangle Grid.Row="0" Grid.Column="0"
  215. HorizontalAlignment="Stretch"
  216. VerticalAlignment="Center"
  217. Fill="LightGray"
  218. Height="1"/>
  219. <Rectangle Grid.Row="0" Grid.Column="2"
  220. HorizontalAlignment="Stretch"
  221. VerticalAlignment="Center"
  222. Fill="LightGray"
  223. Height="1"/>
  224. <Button x:Name="FoldButton"
  225. Grid.Row="0"
  226. Grid.Column="1"
  227. Click="FoldButton_Click"
  228. Tag="{Binding}"
  229. Margin="5">
  230. <DockPanel>
  231. <Image Width="32" Height="32"
  232. RenderTransformOrigin="0.5,0.5" Source="pack://application:,,,/Resources/rightarrow.png"
  233. DockPanel.Dock="Left">
  234. <Image.Style>
  235. <Style TargetType="Image">
  236. <Style.Triggers>
  237. <DataTrigger Binding="{Binding Collapsed}" Value="False">
  238. <Setter Property="RenderTransform">
  239. <Setter.Value>
  240. <RotateTransform Angle="90"/>
  241. </Setter.Value>
  242. </Setter>
  243. </DataTrigger>
  244. </Style.Triggers>
  245. </Style>
  246. </Image.Style>
  247. </Image>
  248. <Label Content="{Binding Status, Converter={StaticResource KanbanStatusToStringConverter}}"
  249. VerticalContentAlignment="Center"
  250. HorizontalContentAlignment="Left"
  251. DockPanel.Dock="Right"/>
  252. </DockPanel>
  253. </Button>
  254. <Border Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3">
  255. <ItemsControl Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3"
  256. ItemsSource="{Binding EmployeeCategories}">
  257. <ItemsControl.ItemsPanel>
  258. <ItemsPanelTemplate>
  259. <UniformGrid Rows="1"/>
  260. </ItemsPanelTemplate>
  261. </ItemsControl.ItemsPanel>
  262. <ItemsControl.ItemTemplate>
  263. <DataTemplate DataType="local:TasksByUserEmployeeCategory">
  264. <Border BorderBrush="LightGray"
  265. BorderThickness="0,0,1,0"
  266. Padding="5,0">
  267. <Grid Tag="{Binding}"
  268. Background="Transparent"
  269. AllowDrop="True"
  270. DragOver="ItemsControl_DragOver"
  271. Drop="ItemsControl_Drop">
  272. <Grid.RowDefinitions>
  273. <RowDefinition Height="Auto"/>
  274. <RowDefinition Height="*"/>
  275. <RowDefinition>
  276. <RowDefinition.Style>
  277. <Style TargetType="{x:Type RowDefinition}">
  278. <Setter Property="Height" Value="75"/>
  279. <Style.Triggers>
  280. <DataTrigger Binding="{Binding Mode,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:TasksByUserControl}}}"
  281. Value="{x:Static local:KanbanViewMode.Compact}">
  282. <Setter Property="Height" Value="30"/>
  283. </DataTrigger>
  284. </Style.Triggers>
  285. </Style>
  286. </RowDefinition.Style>
  287. </RowDefinition>
  288. </Grid.RowDefinitions>
  289. <ItemsControl Grid.Row="0"
  290. ItemsSource="{Binding Tasks,Mode=OneWay}">
  291. <ItemsControl.Style>
  292. <Style TargetType="{x:Type ItemsControl}">
  293. <Setter Property="ItemTemplate" Value="{StaticResource FullKanban}"/>
  294. <Style.Triggers>
  295. <DataTrigger Binding="{Binding Mode,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:TasksByUserControl}}}"
  296. Value="{x:Static local:KanbanViewMode.Compact}">
  297. <Setter Property="ItemTemplate" Value="{StaticResource CompactKanban}"/>
  298. </DataTrigger>
  299. </Style.Triggers>
  300. </Style>
  301. </ItemsControl.Style>
  302. </ItemsControl>
  303. </Grid>
  304. </Border>
  305. </DataTemplate>
  306. </ItemsControl.ItemTemplate>
  307. </ItemsControl>
  308. </Border>
  309. </Grid>
  310. </DataTemplate>
  311. </ItemsControl.ItemTemplate>
  312. </ItemsControl>
  313. </ScrollViewer>
  314. </Grid>
  315. </dynamicgrid:DynamicSplitPanel.Detail>
  316. </dynamicgrid:DynamicSplitPanel>
  317. </UserControl>