mirror of
https://github.com/VitalickS/BrightSharp.Toolkit.git
synced 2026-03-21 02:21:15 +00:00
Fixes: improve ErrorTemplate, ToolWindow style, + InverseBooleanToVisibilityConverter
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
xmlns:bs="http://schemas.brightsharp.com/developer"
|
xmlns:bs="http://schemas.brightsharp.com/developer"
|
||||||
xmlns:local="clr-namespace:BrightSharp.Ui.Tests"
|
xmlns:local="clr-namespace:BrightSharp.Ui.Tests"
|
||||||
mc:Ignorable="d" ResizeMode="CanResizeWithGrip"
|
mc:Ignorable="d" ResizeMode="CanResizeWithGrip"
|
||||||
|
WindowStyle="ToolWindow"
|
||||||
Height="640" Width="1000" Style="{DynamicResource BrightSharpWindowStyle}">
|
Height="640" Width="1000" Style="{DynamicResource BrightSharpWindowStyle}">
|
||||||
<bs:MarkupExtensionProperties.Header>
|
<bs:MarkupExtensionProperties.Header>
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
<Compile Include="Behaviors\SelectAllTextOnFocusBehavior.cs" />
|
<Compile Include="Behaviors\SelectAllTextOnFocusBehavior.cs" />
|
||||||
<Compile Include="Commands\AsyncCommand.cs" />
|
<Compile Include="Commands\AsyncCommand.cs" />
|
||||||
<Compile Include="Commands\RelayCommand.cs" />
|
<Compile Include="Commands\RelayCommand.cs" />
|
||||||
|
<Compile Include="Converters\InverseBooleanToVisibilityConverter.cs" />
|
||||||
<Compile Include="Converters\StringHelpConverter.cs" />
|
<Compile Include="Converters\StringHelpConverter.cs" />
|
||||||
<Compile Include="Diagrams\Adorners\ResizeRotateAdorner.cs" />
|
<Compile Include="Diagrams\Adorners\ResizeRotateAdorner.cs" />
|
||||||
<Compile Include="Diagrams\Adorners\ResizeRotateChrome.cs" />
|
<Compile Include="Diagrams\Adorners\ResizeRotateChrome.cs" />
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace BrightSharp.Commands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnCanExecuteChanged()
|
public virtual void OnCanExecuteChanged()
|
||||||
{
|
{
|
||||||
CanExecuteChanged?.Invoke(this, new EventArgs());
|
CanExecuteChanged?.Invoke(this, new EventArgs());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace BrightSharp.Converters
|
||||||
|
{
|
||||||
|
[Localizability(LocalizationCategory.NeverLocalize)]
|
||||||
|
public class InverseBooleanToVisibilityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
private BooleanToVisibilityConverter _converter = new BooleanToVisibilityConverter();
|
||||||
|
|
||||||
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
|
||||||
|
var result = _converter.Convert(value, targetType, parameter, culture) as Visibility?;
|
||||||
|
return result == Visibility.Collapsed ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
|
||||||
|
var result = _converter.ConvertBack(value, targetType, parameter, culture) as bool?;
|
||||||
|
return result == true ? false : true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4869,9 +4869,29 @@
|
|||||||
<Setter Property="Validation.ErrorTemplate">
|
<Setter Property="Validation.ErrorTemplate">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate>
|
<ControlTemplate>
|
||||||
<Grid>
|
<Grid MaxWidth="{Binding ElementName=MyAdorner, Path=ActualWidth}">
|
||||||
<AdornedElementPlaceholder Name="MyAdorner"/>
|
<Grid.RowDefinitions>
|
||||||
<Border Opacity="0" VerticalAlignment="Center" Width="14" Height="14" HorizontalAlignment="Right" BorderBrush="White" BorderThickness="1" CornerRadius="7" Margin="0,0,4,0"
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<AdornedElementPlaceholder Name="MyAdorner" Grid.Row="1"/>
|
||||||
|
<Label Margin="0,0,0,2" Visibility="{Binding ElementName=MyAdorner, Path=AdornedElement.IsFocused, Converter={StaticResource btvc}}" MaxWidth="250" Foreground="White" BorderBrush="DarkGray" BorderThickness="1" Background="#8F00" VerticalAlignment="Top" HorizontalAlignment="Right" IsHitTestVisible="False" HorizontalContentAlignment="Right">
|
||||||
|
<Label.Triggers>
|
||||||
|
<EventTrigger RoutedEvent="Loaded">
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" Duration="0:0:.6">
|
||||||
|
<DoubleAnimation.EasingFunction>
|
||||||
|
<ExponentialEase />
|
||||||
|
</DoubleAnimation.EasingFunction>
|
||||||
|
</DoubleAnimation>
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</EventTrigger>
|
||||||
|
</Label.Triggers>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding ElementName=MyAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"></TextBlock>
|
||||||
|
</Label>
|
||||||
|
<Border Grid.Row="1" VerticalAlignment="Center" Width="15" Height="14" HorizontalAlignment="Right" BorderBrush="White" BorderThickness="1" CornerRadius="7" Margin="0,0,4,0"
|
||||||
ToolTip="{Binding ElementName=MyAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
|
ToolTip="{Binding ElementName=MyAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
|
||||||
<Border.Background>
|
<Border.Background>
|
||||||
<SolidColorBrush Color="{DynamicResource ValidationErrorColor}" />
|
<SolidColorBrush Color="{DynamicResource ValidationErrorColor}" />
|
||||||
@@ -4880,7 +4900,7 @@
|
|||||||
<EventTrigger RoutedEvent="Loaded">
|
<EventTrigger RoutedEvent="Loaded">
|
||||||
<BeginStoryboard>
|
<BeginStoryboard>
|
||||||
<Storyboard>
|
<Storyboard>
|
||||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:.6">
|
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" Duration="0:0:.6">
|
||||||
<DoubleAnimation.EasingFunction>
|
<DoubleAnimation.EasingFunction>
|
||||||
<ExponentialEase />
|
<ExponentialEase />
|
||||||
</DoubleAnimation.EasingFunction>
|
</DoubleAnimation.EasingFunction>
|
||||||
@@ -5760,6 +5780,10 @@
|
|||||||
</Border>
|
</Border>
|
||||||
</Border>
|
</Border>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="WindowStyle" Value="ToolWindow">
|
||||||
|
<Setter TargetName="PART_MaximizeButton" Property="Visibility" Value="Collapsed" />
|
||||||
|
<Setter TargetName="PART_MinimizeButton" Property="Visibility" Value="Collapsed" />
|
||||||
|
</Trigger>
|
||||||
<Trigger Property="WindowState" Value="Maximized">
|
<Trigger Property="WindowState" Value="Maximized">
|
||||||
<Setter TargetName="PART_MaximizeButton" Property="Content" Value="2" />
|
<Setter TargetName="PART_MaximizeButton" Property="Content" Value="2" />
|
||||||
<Setter TargetName="ContentPresenter" Property="Margin" Value="2,0,4,4" />
|
<Setter TargetName="ContentPresenter" Property="Margin" Value="2,0,4,4" />
|
||||||
|
|||||||
Reference in New Issue
Block a user