|
@@ -6,6 +6,7 @@
|
|
xmlns:local="clr-namespace:LR1"
|
|
xmlns:local="clr-namespace:LR1"
|
|
xmlns:command="clr-namespace:LR1.Commands"
|
|
xmlns:command="clr-namespace:LR1.Commands"
|
|
xmlns:core ="clr-namespace:LR1.Model"
|
|
xmlns:core ="clr-namespace:LR1.Model"
|
|
|
|
+ xmlns:rule ="clr-namespace:LR1.ValidationRules"
|
|
mc:Ignorable="d"
|
|
mc:Ignorable="d"
|
|
d:DesignHeight="500" d:DesignWidth="800"
|
|
d:DesignHeight="500" d:DesignWidth="800"
|
|
Title="Workers" Loaded="Page_Loaded">
|
|
Title="Workers" Loaded="Page_Loaded">
|
|
@@ -58,6 +59,14 @@
|
|
<DataGrid Margin="25,129,25,25" Name="DataGridEmployee" ItemsSource="{Binding}" AutoGenerateColumns="False" HorizontalAlignment="Left"
|
|
<DataGrid Margin="25,129,25,25" Name="DataGridEmployee" ItemsSource="{Binding}" AutoGenerateColumns="False" HorizontalAlignment="Left"
|
|
MaxWidth="1000" MaxHeight="295" RowBackground="#FFE6D3EF" AlternatingRowBackground="#FC96CFD4" BorderBrush="#FF1F33EB"
|
|
MaxWidth="1000" MaxHeight="295" RowBackground="#FFE6D3EF" AlternatingRowBackground="#FC96CFD4" BorderBrush="#FF1F33EB"
|
|
BorderThickness="3" IsReadOnly="True" RowHeight="25" Cursor="Hand" CanUserAddRows="False" CanUserDeleteRows="False">
|
|
BorderThickness="3" IsReadOnly="True" RowHeight="25" Cursor="Hand" CanUserAddRows="False" CanUserDeleteRows="False">
|
|
|
|
+ <DataGrid.RowValidationErrorTemplate>
|
|
|
|
+ <ControlTemplate>
|
|
|
|
+ <Grid Margin="0,-2,0,-2" ToolTip="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGridRow}},Path=(Validation.Errors)[0].ErrorContent}">
|
|
|
|
+ <Ellipse StrokeThickness="0" Fill="Red" Width="{TemplateBinding FontSize}" Height="{TemplateBinding FontSize}"/>
|
|
|
|
+ <TextBlock Text="!" FontSize="{TemplateBinding FontSize}" FontWeight="Bold" Foreground="White" HorizontalAlignment="Center"/>
|
|
|
|
+ </Grid>
|
|
|
|
+ </ControlTemplate>
|
|
|
|
+ </DataGrid.RowValidationErrorTemplate>
|
|
<DataGrid.Columns>
|
|
<DataGrid.Columns>
|
|
<DataGridTextColumn Header="ID" Width="25" Binding="{Binding ID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
|
<DataGridTextColumn Header="ID" Width="25" Binding="{Binding ID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
|
<DataGridTextColumn Header="Фамилия" Width="80" Binding="{Binding Surname, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
|
<DataGridTextColumn Header="Фамилия" Width="80" Binding="{Binding Surname, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
|
@@ -70,7 +79,15 @@
|
|
CellTemplate="{StaticResource DataTemplate}"
|
|
CellTemplate="{StaticResource DataTemplate}"
|
|
CellEditingTemplate="{StaticResource EditingDataTemplate}"/>
|
|
CellEditingTemplate="{StaticResource EditingDataTemplate}"/>
|
|
<DataGridTextColumn Header="Телефон" Width="120" Binding="{Binding Telephone, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
|
<DataGridTextColumn Header="Телефон" Width="120" Binding="{Binding Telephone, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
|
- <DataGridTextColumn Header="Электронная почта" Width="*" Binding="{Binding Email, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
|
|
|
|
|
|
+ <DataGridTextColumn Header="Электронная почта" Width="*" EditingElementStyle="{StaticResource errorStyle}">
|
|
|
|
+ <DataGridTextColumn.Binding >
|
|
|
|
+ <Binding Path="Email" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" ValidatesOnExceptions ="True" >
|
|
|
|
+ <Binding.ValidationRules>
|
|
|
|
+ <rule:EmailRule />
|
|
|
|
+ </Binding.ValidationRules>
|
|
|
|
+ </Binding>
|
|
|
|
+ </DataGridTextColumn.Binding>
|
|
|
|
+ </DataGridTextColumn>
|
|
</DataGrid.Columns>
|
|
</DataGrid.Columns>
|
|
</DataGrid>
|
|
</DataGrid>
|
|
<Label Style="{DynamicResource LabaelStyle}" Content="Список сотрудников" HorizontalAlignment="Left" Margin="25,90,0,0" VerticalAlignment="Top"/>
|
|
<Label Style="{DynamicResource LabaelStyle}" Content="Список сотрудников" HorizontalAlignment="Left" Margin="25,90,0,0" VerticalAlignment="Top"/>
|