mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Conditions/databindings - Fixed data model display option
Databindings - Fixed data bindings UI dissapearing on rapid clicks
This commit is contained in:
parent
8294cc306a
commit
bdad5b9511
@ -29,40 +29,35 @@
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Button Background="{Binding ButtonBrush}"
|
||||
BorderBrush="{Binding ButtonBrush}"
|
||||
Style="{StaticResource DataModelConditionButton}"
|
||||
ToolTip="{Binding SelectedPropertyViewModel.DisplayPropertyPath}"
|
||||
IsEnabled="{Binding IsEnabled}"
|
||||
HorizontalAlignment="Left"
|
||||
Click="PropertyButton_OnClick">
|
||||
<Button.ContextMenu>
|
||||
<ContextMenu ItemsSource="{Binding DataModelViewModel.Children}" IsOpen="{Binding IsDataModelViewModelOpen, Mode=OneWayToSource}">
|
||||
<ContextMenu.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MaterialDesignMenuItem}">
|
||||
<Setter Property="ItemsSource" Value="{Binding Children}" />
|
||||
<Setter Property="Command" Value="{Binding Data.SelectPropertyCommand, Source={StaticResource DataContextProxy}}" />
|
||||
<Setter Property="CommandParameter" Value="{Binding}" />
|
||||
<Setter Property="CommandTarget" Value="{Binding}" />
|
||||
<Setter Property="IsEnabled" Value="{Binding IsMatchingFilteredTypes}" />
|
||||
<Setter Property="IsSubmenuOpen" Value="{Binding IsVisualizationExpanded, Mode=TwoWay}" />
|
||||
<Setter Property="HeaderTemplate" Value="{StaticResource DataModelDataTemplate}" />
|
||||
</Style>
|
||||
</ContextMenu.ItemContainerStyle>
|
||||
</ContextMenu>
|
||||
</Button.ContextMenu>
|
||||
<Grid>
|
||||
<TextBlock Text="{Binding SelectedPropertyViewModel.PropertyDescription.Name}"
|
||||
Visibility="{Binding SelectedPropertyViewModel, Converter={StaticResource NullToVisibilityConverter}}" />
|
||||
<TextBlock FontStyle="Italic"
|
||||
Visibility="{Binding SelectedPropertyViewModel, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Inverted}">
|
||||
<Run Text="« " /><Run Text="{Binding Placeholder}" /><Run Text=" »" />
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Button>
|
||||
|
||||
|
||||
|
||||
|
||||
<Button Background="{Binding ButtonBrush}"
|
||||
BorderBrush="{Binding ButtonBrush}"
|
||||
Style="{StaticResource DataModelConditionButton}"
|
||||
ToolTip="{Binding SelectedPropertyViewModel.DisplayPropertyPath}"
|
||||
IsEnabled="{Binding IsEnabled}"
|
||||
HorizontalAlignment="Left"
|
||||
Click="PropertyButton_OnClick">
|
||||
<Button.ContextMenu>
|
||||
<ContextMenu ItemsSource="{Binding DataModelViewModel.Children}" IsOpen="{Binding IsDataModelViewModelOpen, Mode=OneWayToSource}">
|
||||
<ContextMenu.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MaterialDesignMenuItem}">
|
||||
<Setter Property="ItemsSource" Value="{Binding Children}" />
|
||||
<Setter Property="Command" Value="{Binding Data.SelectPropertyCommand, Source={StaticResource DataContextProxy}}" />
|
||||
<Setter Property="CommandParameter" Value="{Binding}" />
|
||||
<Setter Property="CommandTarget" Value="{Binding}" />
|
||||
<Setter Property="IsEnabled" Value="{Binding IsMatchingFilteredTypes}" />
|
||||
<Setter Property="IsSubmenuOpen" Value="{Binding IsVisualizationExpanded, Mode=TwoWay}" />
|
||||
<Setter Property="HeaderTemplate" Value="{StaticResource DataModelDataTemplate}" />
|
||||
</Style>
|
||||
</ContextMenu.ItemContainerStyle>
|
||||
</ContextMenu>
|
||||
</Button.ContextMenu>
|
||||
<Grid>
|
||||
<TextBlock Text="{Binding SelectedPropertyViewModel.PropertyDescription.Name}"
|
||||
Visibility="{Binding SelectedPropertyViewModel, Converter={StaticResource NullToVisibilityConverter}}" />
|
||||
<TextBlock FontStyle="Italic"
|
||||
Visibility="{Binding SelectedPropertyViewModel, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Inverted}">
|
||||
<Run Text="« " /><Run Text="{Binding Placeholder}" /><Run Text=" »" />
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Button>
|
||||
</UserControl>
|
||||
@ -74,21 +74,7 @@
|
||||
|
||||
<!-- Value display -->
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock Text="{Binding DisplayValue, Mode=OneWay}"
|
||||
FontFamily="Consolas"
|
||||
HorizontalAlignment="Right"
|
||||
Visibility="{Binding ShowToString, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}"
|
||||
Margin="15 0.5 0 0" />
|
||||
<TextBlock Text="null"
|
||||
FontFamily="Consolas"
|
||||
HorizontalAlignment="Right"
|
||||
Foreground="{DynamicResource MaterialDesignCheckBoxDisabled}"
|
||||
Margin="15 0.5 0 0"
|
||||
Visibility="{Binding ShowNull, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}" />
|
||||
<ContentControl s:View.Model="{Binding DisplayViewModel}"
|
||||
FontFamily="Consolas"
|
||||
Margin="15 0.5 0 0"
|
||||
Visibility="{Binding ShowViewModel, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}" />
|
||||
<ContentControl s:View.Model="{Binding DisplayViewModel}" FontFamily="Consolas" Margin="15 0.5 0 0"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
||||
@ -221,7 +221,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
|
||||
NotifyOfPropertyChange(nameof(TimeCaretPosition));
|
||||
}
|
||||
|
||||
private void ProfileEditorServiceOnSelectedDataBindingChanged(object? sender, EventArgs e)
|
||||
private void ProfileEditorServiceOnSelectedDataBindingChanged(object sender, EventArgs e)
|
||||
{
|
||||
RightSideIndex = ProfileEditorService.SelectedDataBinding != null ? 1 : 0;
|
||||
}
|
||||
|
||||
@ -10,14 +10,38 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
|
||||
<converters:PropertyTreeMarginConverter Length="20" x:Key="PropertyTreeMarginConverter" />
|
||||
<Style x:Key="DataBindingsButton" TargetType="shared:LockableToggleButton" BasedOn="{StaticResource MaterialDesignFlatToggleButton}">
|
||||
<Style.Triggers>
|
||||
<EventTrigger RoutedEvent="Button.Click">
|
||||
<EventTrigger.Actions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="IsEnabled">
|
||||
<DiscreteBooleanKeyFrame KeyTime="00:00:00" Value="False" />
|
||||
<DiscreteBooleanKeyFrame KeyTime="00:00:00.3" Value="True" />
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger.Actions>
|
||||
</EventTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Border Name="Bd"
|
||||
BorderBrush="{DynamicResource MaterialDesignDivider}"
|
||||
BorderThickness="0,0,0,1"
|
||||
Height="25">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding LayerPropertyViewModel.IsHighlighted, Mode=OneWay}" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource MaterialDesignPaper}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<Grid Margin="{Binding Converter={StaticResource PropertyTreeMarginConverter}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@ -55,7 +79,7 @@
|
||||
</ContentControl>
|
||||
|
||||
<shared:LockableToggleButton Grid.Column="3"
|
||||
Style="{StaticResource MaterialDesignFlatToggleButton}"
|
||||
Style="{StaticResource DataBindingsButton}"
|
||||
ToolTip="Change the property's data binding"
|
||||
Width="20"
|
||||
Height="20"
|
||||
|
||||
@ -200,6 +200,7 @@ namespace Artemis.UI.Screens.ProfileEditor
|
||||
{
|
||||
Profiles.Add(descriptor);
|
||||
Profiles.Sort(p => p.Name);
|
||||
SelectedProfile = descriptor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user