Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
fix: problem entering to name field, and missing pages input
Browse files Browse the repository at this point in the history
  • Loading branch information
Oskarowski committed May 27, 2024
1 parent 3ef29a3 commit a188cbc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 16 additions & 1 deletion Library/Presentation/View/Product/ProductMasterView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@
</Validation.ErrorTemplate>
</TextBox>

<Label Content="Pages:" FontSize="10"/>
<TextBox Height="20" Width="120" Margin="50,0,10,0"
Text="{Binding Pages, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
TextWrapping="Wrap"
BorderBrush="Gray">
<Validation.ErrorTemplate>
<ControlTemplate>
<StackPanel>
<AdornedElementPlaceholder x:Name="placeholder"/>
<TextBlock Text="{Binding [0].ErrorContent}" Foreground="Red"/>
</StackPanel>
</ControlTemplate>
</Validation.ErrorTemplate>
</TextBox>

<Label Content="Publisher:" FontSize="10"/>
<TextBox Height="20" Width="120" Margin="50,0,10,0"
Text="{Binding Publisher, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
Expand Down Expand Up @@ -151,7 +166,7 @@
</TextBox>

</StackPanel>
<Button Content="Create" Margin="46,287,46,99" Background="CornflowerBlue"
<Button Content="Create" Margin="46,329,46,57" Background="CornflowerBlue"
Command="{Binding CreateProduct}" Grid.Column="1" Grid.Row="1"/>
<Label Margin="0,20,0,506"
HorizontalAlignment="Center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ private bool CanStoreProduct()
return !(
string.IsNullOrWhiteSpace(this.Name) ||
string.IsNullOrWhiteSpace(this.Price.ToString()) ||
string.IsNullOrWhiteSpace(this.Author.ToString()) ||
string.IsNullOrWhiteSpace(this.Publisher.ToString()) ||
string.IsNullOrWhiteSpace(this.Author) ||
string.IsNullOrWhiteSpace(this.Publisher) ||
string.IsNullOrWhiteSpace(this.Pages.ToString()) ||
string.IsNullOrWhiteSpace(this.PublicationDate.ToString()) ||
this.Price <= 0 ||
Expand Down

0 comments on commit a188cbc

Please sign in to comment.