UI - Fixed a lot of binding errors

UI - Added most missing DisposeWith calls
This commit is contained in:
Robert committed 2022-04-02 01:10:06 +02:00
1 parent 8fd18b9565
commit 372991a69b
28 files changed
+347 -230

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
using System;
using System.Windows.Input;
namespace Artemis.UI.Shared;
/// <summary>
/// Represents a placeholder command that does nothing and can't be executed.
/// </summary>
public class NullCommand : ICommand
{
private static readonly Lazy<NullCommand> _instance = new(() => new NullCommand());
private NullCommand()
{
}
/// <summary>
/// Gets the static instance of this command.
/// </summary>
public static ICommand Instance => _instance.Value;
/// <inheritdoc />
public event EventHandler? CanExecuteChanged;
/// <inheritdoc />
public void Execute(object? parameter)
{
throw new InvalidOperationException("NullCommand cannot be executed");
}
/// <inheritdoc />
public bool CanExecute(object? parameter)
{
return false;
}
}
+7 -17
View File
@@ -1,24 +1,14 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Styles.Resources>
<VisualBrush x:Key="CheckerboardBrush" TileMode="Tile" Stretch="Uniform" DestinationRect="0,0,15,15">
<VisualBrush x:Key="CheckerboardBrush" TileMode="Tile" Stretch="Uniform" DestinationRect="0,0,12,12">
<VisualBrush.Visual>
<Grid Width="15" Height="15" RowDefinitions="*,*" ColumnDefinitions="*,*">
<Rectangle Grid.Row="0" Grid.Column="0" Fill="Black" Opacity="0.15" />
<Rectangle Grid.Row="0" Grid.Column="1" />
<Rectangle Grid.Row="1" Grid.Column="0" />
<Rectangle Grid.Row="1" Grid.Column="1" Fill="Black" Opacity="0.15" />
</Grid>
</VisualBrush.Visual>
</VisualBrush>
<VisualBrush x:Key="LargeCheckerboardBrush" TileMode="Tile" Stretch="Uniform" SourceRect="0,0,25,25">
<VisualBrush.Visual>
<Grid Width="25" Height="25" RowDefinitions="*,*" ColumnDefinitions="*,*">
<Rectangle Grid.Row="0" Grid.Column="0" Fill="Black" Opacity="0.15" />
<Rectangle Grid.Row="0" Grid.Column="1" />
<Rectangle Grid.Row="1" Grid.Column="0" />
<Rectangle Grid.Row="1" Grid.Column="1" Fill="Black" Opacity="0.15" />
</Grid>
<Canvas Width="12" Height="12">
<Rectangle Width="6" Height="6" Fill="Black" Opacity="0.15" />
<Rectangle Width="6" Height="6" Canvas.Left="6" />
<Rectangle Width="6" Height="6" Canvas.Top="6" />
<Rectangle Width="6" Height="6" Canvas.Left="6" Canvas.Top="6" Fill="Black" Opacity="0.15" />
</Canvas>
</VisualBrush.Visual>
</VisualBrush>
</Styles.Resources>
@@ -88,9 +88,9 @@
Background="{DynamicResource LightCheckerboardBrush}"
Margin="5 0">
<Border Background="{TemplateBinding LinearGradientBrush}">
<ItemsControl Items="{TemplateBinding ColorGradient}" ClipToBounds="False">
<ItemsControl Name="GradientStops" Items="{TemplateBinding ColorGradient}" ClipToBounds="False">
<ItemsControl.Styles>
<Style Selector="ContentPresenter">
<Style Selector="ItemsControl#GradientStops > ContentPresenter">
<Setter Property="Canvas.Left">
<Setter.Value>
<MultiBinding Converter="{StaticResource WidthNormalizedConverter}">