mirror of
https://github.com/Tichau/FileConverter.git
synced 2026-11-29 09:44:56 +01:00
Highlight in red in the treeview elements that contains errors.
This commit is contained in:
1 parent
1cc3823b1a
commit
212854edda
3 files changed
+13
-1
No files matched your search
@@ -41,6 +41,8 @@ namespace FileConverter.ViewModels
|
||||
|
||||
public string this[string columnName] => this.Validate(columnName);
|
||||
|
||||
public bool HasError => !string.IsNullOrEmpty(this.Error);
|
||||
|
||||
public string Error
|
||||
{
|
||||
get
|
||||
@@ -135,6 +137,7 @@ namespace FileConverter.ViewModels
|
||||
{
|
||||
this.Preset.ShortName = value;
|
||||
this.RaisePropertyChanged();
|
||||
this.RaisePropertyChanged(nameof(this.HasError));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,6 +260,7 @@ namespace FileConverter.ViewModels
|
||||
{
|
||||
this.name = value;
|
||||
this.RaisePropertyChanged();
|
||||
this.RaisePropertyChanged(nameof(this.HasError));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Data validation styles -->
|
||||
|
||||
<Style TargetType="{x:Type TextBox}">
|
||||
<Setter Property="Validation.ErrorTemplate">
|
||||
<Setter.Value>
|
||||
|
||||
@@ -100,7 +100,12 @@
|
||||
</DataTemplate>
|
||||
</TreeView.Resources>
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="TreeViewItem">
|
||||
<Style TargetType="{x:Type TreeViewItem}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding HasError, FallbackValue=False}" Value="True">
|
||||
<Setter Property="Background" Value="#F44336"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Style.Resources>
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#86C8F6" />
|
||||
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#074078" />
|
||||
@@ -110,6 +115,7 @@
|
||||
|
||||
<Setter Property="IsExpanded" Value="True"/>
|
||||
<Setter Property="BorderBrush" Value="#1E6BB8"/>
|
||||
|
||||
<EventSetter Event="TreeViewItem.DragOver" Handler="TreeView_DragOver"/>
|
||||
<EventSetter Event="TreeViewItem.Drop" Handler="TreeView_Drop"/>
|
||||
<EventSetter Event="TreeViewItem.MouseMove" Handler="TreeView_MouseMove"/>
|
||||
|
||||
Reference in new issue
Block a user