WIP - Changed Bindings into CompiledBindings

This commit is contained in:
Diogo Trindade committed 2023-04-30 21:39:21 +01:00
1 parent 33f375e608
commit 59f9479d9a
56 files changed
+293 -251

No files matched your search

@@ -1,4 +1,4 @@
<UserControl xmlns="https://github.com/avaloniaui"
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -25,12 +25,12 @@
<Panel>
<controls:NumberBox Name="InnerNumberBox"
AcceptsExpression="True"
LargeChange="{Binding $parent[sharedControls:DraggableNumberBox].LargeChange}"
SmallChange="{Binding $parent[sharedControls:DraggableNumberBox].SmallChange}"
SimpleNumberFormat="{Binding $parent[sharedControls:DraggableNumberBox].SimpleNumberFormat}"
attachedProperties:NumberBoxAssist.PrefixText="{Binding $parent[sharedControls:DraggableNumberBox].Prefix}"
attachedProperties:NumberBoxAssist.SuffixText="{Binding $parent[sharedControls:DraggableNumberBox].Suffix}"
HorizontalAlignment="{Binding $parent[sharedControls:DraggableNumberBox].HorizontalAlignment}"
LargeChange="{CompiledBinding $parent[sharedControls:DraggableNumberBox].LargeChange}"
SmallChange="{CompiledBinding $parent[sharedControls:DraggableNumberBox].SmallChange}"
SimpleNumberFormat="{CompiledBinding $parent[sharedControls:DraggableNumberBox].SimpleNumberFormat}"
attachedProperties:NumberBoxAssist.PrefixText="{CompiledBinding $parent[sharedControls:DraggableNumberBox].Prefix}"
attachedProperties:NumberBoxAssist.SuffixText="{CompiledBinding $parent[sharedControls:DraggableNumberBox].Suffix}"
HorizontalAlignment="{CompiledBinding $parent[sharedControls:DraggableNumberBox].HorizontalAlignment}"
ValueChanged="NumberBox_OnValueChanged"/>
<Rectangle Name="DragCollider" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Fill="Transparent"></Rectangle>
</Panel>
@@ -26,8 +26,8 @@
</UserControl.Styles>
<shared:NoInputTextBox x:Name="DisplayTextBox"
Watermark="{Binding $parent.Watermark}"
UseFloatingWatermark="{Binding $parent.UseFloatingWatermark}"
Watermark="{CompiledBinding $parent.Watermark}"
UseFloatingWatermark="{CompiledBinding $parent.UseFloatingWatermark}"
Classes="clearButton"
IsReadOnly="True"
HorizontalAlignment="Stretch" />
@@ -35,6 +35,7 @@ public partial class HotkeyBox : UserControl
UpdateDisplayTextBox();
}
/// <inheritdoc />
protected override void OnGotFocus(GotFocusEventArgs e)
{
_inputService.KeyboardKeyDown += InputServiceOnKeyboardKeyDown;
@@ -43,6 +44,7 @@ public partial class HotkeyBox : UserControl
base.OnGotFocus(e);
}
/// <inheritdoc />
protected override void OnLostFocus(RoutedEventArgs e)
{
_inputService.KeyboardKeyDown -= InputServiceOnKeyboardKeyDown;
@@ -3,22 +3,24 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
xmlns:local="clr-namespace:Artemis.UI.Shared.DefaultTypes.DataModel.Display"
x:DataType="local:DefaultDataModelDisplayViewModel"
x:Class="Artemis.UI.Shared.DefaultTypes.DataModel.Display.DefaultDataModelDisplayView">
<Grid ColumnDefinitions="*,Auto,Auto">
<!-- Prefix -->
<TextBlock Grid.Column="0"
Text="{Binding PropertyDescription.Prefix}"
IsVisible="{Binding PropertyDescription.Prefix, Converter={x:Static ObjectConverters.IsNotNull}}"
Text="{CompiledBinding PropertyDescription.Prefix}"
IsVisible="{CompiledBinding PropertyDescription.Prefix, Converter={x:Static ObjectConverters.IsNotNull}}"
TextAlignment="Right"
Margin="0 0 5 0" />
<!-- Value -->
<TextBlock Grid.Column="1" Text="{Binding Display, Mode=OneWay}" HorizontalAlignment="Right"/>
<TextBlock Grid.Column="1" Text="{CompiledBinding Display, Mode=OneWay}" HorizontalAlignment="Right"/>
<!-- Affix -->
<TextBlock Grid.Column="2"
Text="{Binding PropertyDescription.Affix}"
IsVisible="{Binding PropertyDescription.Affix, Converter={x:Static ObjectConverters.IsNotNull}}"
Text="{CompiledBinding PropertyDescription.Affix}"
IsVisible="{CompiledBinding PropertyDescription.Affix, Converter={x:Static ObjectConverters.IsNotNull}}"
Margin="5 0 0 0" />
</Grid>
</UserControl>
@@ -2,9 +2,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Artemis.UI.Shared.Services"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="800"
x:Class="Artemis.UI.Shared.Services.ExceptionDialogView"
Title="{Binding Title}"
x:DataType="local:ExceptionDialogViewModel"
Title="{CompiledBinding Title}"
ExtendClientAreaToDecorationsHint="True"
Width="800"
Height="800"
@@ -16,7 +18,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Margin="10" Grid.Row="1" IsHitTestVisible="False" Text="{Binding Title}" />
<TextBlock Margin="10" Grid.Row="1" IsHitTestVisible="False" Text="{CompiledBinding Title}" />
<StackPanel Grid.Row="2" Margin="20">
<TextBlock Classes="h3">Awww :(</TextBlock>
@@ -27,7 +29,7 @@
<Grid Grid.Row="3" ColumnDefinitions="*,Auto" RowDefinitions="*,Auto">
<ScrollViewer Grid.Row="0" Grid.ColumnSpan="2" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="20 0">
<TextBox Text="{Binding Exception, Mode=OneTime}"
<TextBox Text="{CompiledBinding Exception, Mode=OneTime}"
AcceptsReturn="True"
IsReadOnly="True"
FontFamily="Consolas"
@@ -39,10 +41,10 @@
When reporting errors please don't take a screenshot of the error, instead copy the text, thanks!
</TextBlock>
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="15">
<Button Command="{Binding CopyException}" Classes="AppBarButton" Width="150" Margin="0 0 5 0">
<Button Command="{CompiledBinding CopyException}" Classes="AppBarButton" Width="150" Margin="0 0 5 0">
Copy exception
</Button>
<Button Command="{Binding Close}" Width="150" Margin="5 0 0 0">
<Button Command="{CompiledBinding Close}" Width="150" Margin="5 0 0 0">
Close
</Button>
</StackPanel>
@@ -19,7 +19,7 @@
<Grid ColumnDefinitions="Auto,*"
RowDefinitions="*"
MinHeight="38"
IsVisible="{Binding DataModelPath, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}">
IsVisible="{CompiledBinding DataModelPath, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}">
<avalonia:MaterialIcon Grid.Column="0"
Grid.Row="0"
Name="CurrentPathIcon"
@@ -27,7 +27,7 @@
Height="22"
Width="22"
Margin="5 0 15 0"
IsVisible="{Binding !IsEventPicker, RelativeSource={RelativeSource TemplatedParent}}"/>
IsVisible="{CompiledBinding !IsEventPicker, RelativeSource={RelativeSource TemplatedParent}}"/>
<avalonia:MaterialIcon Grid.Column="0"
Grid.Row="0"
Name="EventIcon"
@@ -35,14 +35,14 @@
Height="22"
Width="22"
Margin="5 0 15 0"
IsVisible="{Binding IsEventPicker, RelativeSource={RelativeSource TemplatedParent}}"/>
IsVisible="{CompiledBinding IsEventPicker, RelativeSource={RelativeSource TemplatedParent}}"/>
<StackPanel Grid.Column="1" Grid.Row="0" VerticalAlignment="Center">
<TextBlock Name="CurrentPathDisplay" Classes="BodyStrongTextBlockStyle" MaxHeight="50" />
<TextBlock Name="CurrentPathDescription" Classes="BodyTextBlockStyle" Foreground="{DynamicResource TextFillColorSecondary}" MaxHeight="50" />
</StackPanel>
</Grid>
<Grid MinHeight="38"
IsVisible="{Binding DataModelPath, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNull}}" ColumnDefinitions="*,Auto"
IsVisible="{CompiledBinding DataModelPath, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNull}}" ColumnDefinitions="*,Auto"
RowDefinitions="*,*">
<TextBlock Grid.Column="0" Grid.Row="0" Classes="BodyStrongTextBlockStyle">Welcome to the data model picker</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="1" Foreground="{DynamicResource TextFillColorSecondary}">Select a value from the data model below</TextBlock>
@@ -53,19 +53,19 @@
<TreeView Grid.Row="2"
Name="DataModelTreeView"
ItemsSource="{Binding DataModelViewModel.Children, RelativeSource={RelativeSource TemplatedParent}}">
ItemsSource="{CompiledBinding DataModelViewModel.Children, RelativeSource={RelativeSource TemplatedParent}}">
<TreeView.Styles>
<Style Selector="TreeViewItem">
<Setter Property="IsExpanded" Value="{Binding IsVisualizationExpanded, Mode=TwoWay}" />
<Setter Property="IsEnabled" Value="{Binding IsMatchingFilteredTypes, Mode=OneWay}" />
<Setter Property="IsExpanded" Value="{CompiledBinding IsVisualizationExpanded, Mode=TwoWay, DataType=dataModel:DataModelVisualizationViewModel}" />
<Setter Property="IsEnabled" Value="{CompiledBinding IsMatchingFilteredTypes, Mode=OneWay, DataType=dataModel:DataModelVisualizationViewModel}" />
</Style>
</TreeView.Styles>
<TreeView.DataTemplates>
<TreeDataTemplate DataType="{x:Type dataModel:DataModelPropertiesViewModel}" ItemsSource="{Binding Children}">
<TreeDataTemplate DataType="{x:Type dataModel:DataModelPropertiesViewModel}" ItemsSource="{CompiledBinding Children}">
<Grid ColumnDefinitions="Auto,*">
<TextBlock Grid.Column="0" Text="{Binding PropertyDescription.Name}" ToolTip.Tip="{Binding PropertyDescription.Description}" />
<TextBlock Grid.Column="0" Text="{CompiledBinding PropertyDescription.Name}" ToolTip.Tip="{CompiledBinding PropertyDescription.Description}" />
<TextBlock Grid.Column="1"
Text="{Binding DisplayValue}"
Text="{CompiledBinding DisplayValue}"
FontFamily="Consolas"
HorizontalAlignment="Right"
Margin="0 0 10 0" />
@@ -75,29 +75,29 @@
<TreeDataTemplate DataType="{x:Type dataModel:DataModelPropertyViewModel}">
<Grid ColumnDefinitions="Auto,*">
<StackPanel Grid.Column="0" Orientation="Horizontal">
<TextBlock Text="{Binding PropertyDescription.Name}" ToolTip.Tip="{Binding PropertyDescription.Description}" />
<TextBlock Text="{CompiledBinding PropertyDescription.Name}" ToolTip.Tip="{CompiledBinding PropertyDescription.Description}" />
<TextBlock Text=" changed"
ToolTip.Tip="{Binding PropertyDescription.Description}"
IsVisible="{Binding IsEventPicker, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type dataModelPicker:DataModelPicker}}}"/>
ToolTip.Tip="{CompiledBinding PropertyDescription.Description}"
IsVisible="{CompiledBinding IsEventPicker, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type dataModelPicker:DataModelPicker}}}"/>
</StackPanel>
<ContentControl Grid.Column="1" Content="{Binding DisplayViewModel}" FontFamily="Consolas" Margin="0 0 10 0" />
<ContentControl Grid.Column="1" Content="{CompiledBinding DisplayViewModel}" FontFamily="Consolas" Margin="0 0 10 0" />
</Grid>
</TreeDataTemplate>
<TreeDataTemplate DataType="{x:Type dataModel:DataModelListViewModel}">
<Grid ColumnDefinitions="Auto,*">
<TextBlock Grid.Column="0" Text="{Binding PropertyDescription.Name}" ToolTip.Tip="{Binding PropertyDescription.Description}" />
<TextBlock Grid.Column="0" Text="{CompiledBinding PropertyDescription.Name}" ToolTip.Tip="{CompiledBinding PropertyDescription.Description}" />
<TextBlock Grid.Column="1"
Text="{Binding CountDisplay, Mode=OneWay}"
Text="{CompiledBinding CountDisplay, Mode=OneWay}"
FontFamily="Consolas"
HorizontalAlignment="Right"
Margin="0 0 10 0" />
</Grid>
</TreeDataTemplate>
<TreeDataTemplate DataType="{x:Type dataModel:DataModelEventViewModel}" ItemsSource="{Binding Children}">
<TextBlock Text="{Binding PropertyDescription.Name}" ToolTip.Tip="{Binding PropertyDescription.Description}" />
<TreeDataTemplate DataType="{x:Type dataModel:DataModelEventViewModel}" ItemsSource="{CompiledBinding Children}">
<TextBlock Text="{CompiledBinding PropertyDescription.Name}" ToolTip.Tip="{CompiledBinding PropertyDescription.Description}" />
</TreeDataTemplate>
</TreeView.DataTemplates>
</TreeView>
@@ -103,10 +103,10 @@
</ItemsControl.Styles>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="core:ColorGradientStop">
<gradientPicker:GradientPickerColorStop ColorStop="{Binding}"
PositionReference="{Binding $parent[Border]}"
<gradientPicker:GradientPickerColorStop ColorStop="{CompiledBinding}"
PositionReference="{CompiledBinding $parent[Border]}"
Classes="gradient-handle"
GradientPicker="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type gradientPicker:GradientPicker}}}">
GradientPicker="{CompiledBinding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type gradientPicker:GradientPicker}}}">
</gradientPicker:GradientPickerColorStop>
</DataTemplate>
</ItemsControl.ItemTemplate>
@@ -152,7 +152,7 @@
<ItemsControl.ItemTemplate>
<DataTemplate DataType="core:ColorGradientStop">
<Border Classes="stop-position">
<TextBlock Text="{Binding Position}"></TextBlock>
<TextBlock Text="{CompiledBinding Position}"></TextBlock>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
@@ -174,8 +174,8 @@
UseColorTriangle="True"
IsMoreButtonVisible="True"
IsVisible="{TemplateBinding SelectedColorStop, Converter={x:Static ObjectConverters.IsNotNull}}"
IsCompact="{Binding IsCompact, RelativeSource={RelativeSource TemplatedParent}}"
Color="{Binding SelectedColorStop.Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource SKColorToColorConverter}}" />
IsCompact="{CompiledBinding IsCompact, RelativeSource={RelativeSource TemplatedParent}}"
Color="{CompiledBinding SelectedColorStop.Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource SKColorToColorConverter}}" />
</Border>
<Grid Grid.Row="2" Grid.Column="1" RowDefinitions="*,Auto">
@@ -196,19 +196,19 @@
BorderBrush="{DynamicResource ButtonBorderBrush}"
ClipToBounds="True"
Background="{DynamicResource LightCheckerboardBrush}">
<Border CornerRadius="4" Margin="-2" Background="{Binding Color, Converter={StaticResource SKColorToBrushConverter}}" />
<Border CornerRadius="4" Margin="-2" Background="{CompiledBinding Color, Converter={StaticResource SKColorToBrushConverter}}" />
</Border>
<TextBox Grid.Column="1" Text="{Binding Color, Converter={StaticResource SKColorToStringConverter}}" />
<TextBox Grid.Column="1" Text="{CompiledBinding Color, Converter={StaticResource SKColorToStringConverter}}" />
<NumericUpDown Grid.Column="2" FormatString="F3" ShowButtonSpinner="False" Margin="5 0" Minimum="0" Maximum="1" Increment="0.01">
<Interaction.Behaviors>
<behaviors:LostFocusNumericUpDownBindingBehavior Value="{Binding Position}" />
<behaviors:LostFocusNumericUpDownBindingBehavior Value="{CompiledBinding Position}" />
</Interaction.Behaviors>
</NumericUpDown>
<Button Name="DeleteButton"
Grid.Column="3"
Classes="icon-button"
Command="{Binding DeleteStop, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type gradientPicker:GradientPicker}}}"
CommandParameter="{Binding}">
Command="{CompiledBinding DeleteStop, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type gradientPicker:GradientPicker}}}"
CommandParameter="{CompiledBinding}">
<avalonia:MaterialIcon Kind="Close" />
</Button>
</Grid>