TasksByUserControl.xaml 21 KB

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