EmployeeBrowseView.xaml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <Page x:Class="InvestTracker.Views.EmployeeBrowseView"
  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:vm="clr-namespace:InvestTracker.VM"
  7. xmlns:local="clr-namespace:InvestTracker.Views"
  8. xmlns:model="clr-namespace:InvestTracker.Entities"
  9. mc:Ignorable="d"
  10. d:DesignHeight="450" d:DesignWidth="800"
  11. x:Name="EPage"
  12. Title="EmployeeBrowseView">
  13. <Page.Resources>
  14. <!--Шаблон яйчейки отображения даты-->
  15. <DataTemplate x:Key="RegularDateTemplate" >
  16. <TextBlock
  17. Text="{Binding Birthday,StringFormat={}{0:dd\.}{0:MM\.}{0:yyyy}}"
  18. VerticalAlignment="Center"
  19. HorizontalAlignment="Center" />
  20. </DataTemplate>
  21. <!--Шаблон яйчейки редактирования даты-->
  22. <DataTemplate x:Key="EditingDateTemplate">
  23. <DatePicker SelectedDate="{Binding Birthday, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
  24. </DataTemplate>
  25. </Page.Resources>
  26. <StackPanel>
  27. <!--Этот FrameworkElement содержит все свойства у Page-->
  28. <FrameworkElement x:Name="ProxyElement" DataContext="{Binding}" Visibility="Collapsed"/>
  29. <Menu>
  30. <MenuItem Header="Действие" >
  31. <MenuItem Command="{Binding UndoCommand}" Header="Отменить" ></MenuItem>
  32. <Separator/>
  33. <MenuItem Command="{Binding NewCommand}" Header="Создать" ></MenuItem>
  34. <MenuItem Command="{Binding EditCommand}" Header="Редактировать" ></MenuItem>
  35. <MenuItem Command="{Binding SaveCommand}" Header="Сохранить" ></MenuItem>
  36. <MenuItem Command="{Binding FindCommand}" Header="Найти" />
  37. <Separator/>
  38. <MenuItem Command="{Binding DeleteCommand}" Header="Удалить" ></MenuItem>
  39. </MenuItem>
  40. <MenuItem Header="Отчет"></MenuItem>
  41. </Menu>
  42. <ToolBar>
  43. <Button Name="Undo" Command="{Binding UndoCommand}" ToolTip="Отменить редактирование/создание">
  44. <Image Width="16" Height="16" Source="/Images/undo.png" />
  45. </Button>
  46. <Button Name="Add" Command="{Binding NewCommand}" ToolTip="Добавить">
  47. <Image Width="16" Height="16" Source="/Images/add.png" />
  48. </Button>
  49. <Button Name="Edit" Command="{Binding EditCommand}" ToolTip="Редактировать">
  50. <Image Width="16" Height="16" Source="/Images/edit.png" />
  51. </Button>
  52. <Button Name="Search" Command="{Binding FindCommand}" ToolTip="Поиск">
  53. <Image Width="16" Height="16" Source="/Images/search.png" />
  54. </Button>
  55. <Button Name="Save" Command="{Binding SaveCommand}" ToolTip="Сохранить">
  56. <Image Width="16" Height="16" Source="/Images/save.png" />
  57. </Button>
  58. <Button Name="Delete" Command="{Binding DeleteCommand}" ToolTip="Удалить">
  59. <Image Width="16" Height="16" Source="/Images/delete.png" />
  60. </Button>
  61. </ToolBar>
  62. <Label>Список сотрудников</Label>
  63. <DataGrid
  64. AutoGenerateColumns="False"
  65. ItemsSource="{Binding Employees}"
  66. RowBackground="#ddd"
  67. AlternatingRowBackground="#eee"
  68. CanUserAddRows="False"
  69. CanUserDeleteRows="False"
  70. IsReadOnly="{Binding GridBlocked}"
  71. SelectedItem="{Binding SelectedEmployee}">
  72. <DataGrid.Columns>
  73. <DataGridTextColumn
  74. Binding="{Binding Path=Surname,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  75. Header="Фамилия"/>
  76. <DataGridTextColumn
  77. Binding="{Binding Path=Name,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  78. Header="Имя"/>
  79. <DataGridTextColumn
  80. Binding="{Binding Path=Patronymic,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  81. Header="Отчество"/>
  82. <DataGridComboBoxColumn
  83. ItemsSource="{Binding DataContext.AllTitles,Source={x:Reference ProxyElement}}"
  84. DisplayMemberPath="Name"
  85. SelectedValueBinding="{Binding Path=TitleId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  86. SelectedValuePath="Id"
  87. Header="Должность"/>
  88. <DataGridTemplateColumn
  89. CellTemplate="{StaticResource RegularDateTemplate}"
  90. CellEditingTemplate="{StaticResource EditingDateTemplate}"
  91. Header="Дата рождения" />
  92. <DataGridTextColumn
  93. Binding="{Binding Path=Phone,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  94. Header="Телефон" />
  95. <DataGridTextColumn
  96. Binding="{Binding Path=Email,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
  97. Header="Электронная почта" />
  98. </DataGrid.Columns>
  99. </DataGrid>
  100. </StackPanel>
  101. </Page>