Skip to content

Commit

Permalink
Fix some binding errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster620 committed Oct 29, 2023
1 parent 8373abf commit c88dbff
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 163 deletions.
17 changes: 6 additions & 11 deletions ULogViewer/Controls/ContextualBasedAnalysisActionsEditor.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,43 +53,38 @@
</UserControl.Resources>

<Grid RowDefinitions="*,Auto,Auto">
<asControls:ListBox Name="actionListBox" Classes="Dialog_Item_ListBox" IsVisible="{Binding $parent[UserControl].Actions.Count}" ItemsSource="{Binding $parent[UserControl].Actions}">
<asControls:ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</asControls:ListBox.ItemsPanel>
<asControls:ListBox Name="actionListBox" Classes="Dialog_Item_ListBox" IsVisible="{Binding $self.ItemCount}" ItemsPanel="{StaticResource ItemsPanelTemplate/StackPanel}" ItemsSource="{Binding $parent[UserControl].Actions}">
<asControls:ListBox.ItemTemplate>
<DataTemplate>
<Grid ColumnDefinitions="*,Auto">
<Grid Name="itemRoot" ColumnDefinitions="*,Auto">
<TextBlock Grid.Column="0" Text="{Binding}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"/>
<Border Classes="InPlaceAction_Reserved"/>
<StackPanel Grid.Column="1" IsVisible="{Binding $parent[ListBoxItem].IsPointerOver}" Orientation="Horizontal">
<Button Classes="InPlaceAction_Button" Command="{Binding $parent[UserControl].RemoveActionCommand}" CommandParameter="{Binding $parent[ListBoxItem]}" ToolTip.Tip="{DynamicResource String/Common.Delete}">
<asControls:Image Classes="InPlaceAction_Icon">
<DrawingImage>
<GeometryDrawing Brush="{Binding $parent[ListBoxItem].Foreground}" Geometry="{StaticResource Geometry/Icon.Delete}"/>
<GeometryDrawing Brush="{Binding #itemRoot.(TextElement.Foreground)}" Geometry="{StaticResource Geometry/Icon.Delete}"/>
</DrawingImage>
</asControls:Image>
</Button>
<Button Classes="InPlaceAction_Button" Command="{Binding $parent[UserControl].EditActionCommand}" CommandParameter="{Binding $parent[ListBoxItem]}" ToolTip.Tip="{DynamicResource String/Common.Edit}">
<asControls:Image Classes="InPlaceAction_Icon">
<DrawingImage>
<GeometryDrawing Brush="{Binding $parent[ListBoxItem].Foreground}" Geometry="{StaticResource Geometry/Icon.Edit}"/>
<GeometryDrawing Brush="{Binding #itemRoot.(TextElement.Foreground)}" Geometry="{StaticResource Geometry/Icon.Edit}"/>
</DrawingImage>
</asControls:Image>
</Button>
<Button Classes="InPlaceAction_Button" Command="{Binding $parent[UserControl].MoveActionUpCommand}" CommandParameter="{Binding $parent[ListBoxItem]}" ToolTip.Tip="{DynamicResource String/Common.MoveUp}">
<asControls:Image Classes="InPlaceAction_Icon">
<DrawingImage>
<GeometryDrawing Brush="{Binding $parent[ListBoxItem].Foreground}" Geometry="{StaticResource Geometry/Icon.MoveUp}"/>
<GeometryDrawing Brush="{Binding #itemRoot.(TextElement.Foreground)}" Geometry="{StaticResource Geometry/Icon.MoveUp}"/>
</DrawingImage>
</asControls:Image>
</Button>
<Button Classes="InPlaceAction_Button" Command="{Binding $parent[UserControl].MoveActionDownCommand}" CommandParameter="{Binding $parent[ListBoxItem]}" ToolTip.Tip="{DynamicResource String/Common.MoveDown}">
<asControls:Image Classes="InPlaceAction_Icon">
<DrawingImage>
<GeometryDrawing Brush="{Binding $parent[ListBoxItem].Foreground}" Geometry="{StaticResource Geometry/Icon.MoveDown}"/>
<GeometryDrawing Brush="{Binding #itemRoot.(TextElement.Foreground)}" Geometry="{StaticResource Geometry/Icon.MoveDown}"/>
</DrawingImage>
</asControls:Image>
</Button>
Expand Down
24 changes: 10 additions & 14 deletions ULogViewer/Controls/DisplayableLogAnalysisConditionsEditor.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
xmlns:asControls="using:CarinaStudio.AppSuite.Controls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="CarinaStudio.ULogViewer.Controls.DisplayableLogAnalysisConditionsEditor"
Name="root"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch">

<UserControl.Resources>

<ContextMenu x:Key="addConditionMenu" Placement="Bottom">
<MenuItem Command="{Binding $parent[UserControl].AddVarAndConstComparisonCondition}" Header="{DynamicResource String/DisplayableLogAnalysisConditionsEditor.VarAndConstComparisonCondition.WithDialog}"/>
<MenuItem Command="{Binding $parent[UserControl].AddVarsComparisonCondition}" Header="{DynamicResource String/DisplayableLogAnalysisConditionsEditor.VarsComparisonCondition.WithDialog}">
<MenuItem Command="{Binding #root.AddVarAndConstComparisonCondition}" Header="{DynamicResource String/DisplayableLogAnalysisConditionsEditor.VarAndConstComparisonCondition.WithDialog}"/>
<MenuItem Command="{Binding #root.AddVarsComparisonCondition}" Header="{DynamicResource String/DisplayableLogAnalysisConditionsEditor.VarsComparisonCondition.WithDialog}">
<MenuItem.Icon>
<Image Classes="MenuItem_Icon" Source="{StaticResource Image/Variable}"/>
</MenuItem.Icon>
Expand All @@ -22,29 +23,24 @@
</UserControl.Resources>

<Grid RowDefinitions="*,Auto,Auto">
<asControls:ListBox Name="conditionListBox" Classes="Dialog_Item_ListBox" IsVisible="{Binding $parent[UserControl].Conditions.Count}" ItemsSource="{Binding $parent[UserControl].Conditions}" VerticalAlignment="Stretch">
<asControls:ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</asControls:ListBox.ItemsPanel>
<asControls:ListBox Name="conditionListBox" Classes="Dialog_Item_ListBox" IsVisible="{Binding $self.ItemCount}" ItemsPanel="{StaticResource ItemsPanelTemplate/StackPanel}" ItemsSource="{Binding #root.Conditions}" VerticalAlignment="Stretch">
<asControls:ListBox.ItemTemplate>
<DataTemplate>
<Grid ColumnDefinitions="*,Auto">
<Grid Name="itemRoot" ColumnDefinitions="*,Auto">
<TextBlock Grid.Column="0" Text="{Binding}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"/>
<Border Classes="InPlaceAction_Reserved"/>
<StackPanel Grid.Column="1" IsVisible="{Binding $parent[ListBoxItem].IsPointerOver}" Orientation="Horizontal">
<Button Classes="InPlaceAction_Button" Command="{Binding $parent[UserControl].RemoveConditionCommand}" CommandParameter="{Binding $parent[ListBoxItem]}" ToolTip.Tip="{DynamicResource String/Common.Delete}">
<Button Classes="InPlaceAction_Button" Command="{Binding #root.RemoveConditionCommand}" CommandParameter="{Binding $parent[ListBoxItem]}" ToolTip.Tip="{DynamicResource String/Common.Delete}">
<asControls:Image Classes="InPlaceAction_Icon">
<DrawingImage>
<GeometryDrawing Brush="{Binding $parent[ListBoxItem].Foreground}" Geometry="{StaticResource Geometry/Icon.Delete}"/>
<GeometryDrawing Brush="{Binding #itemRoot.(TextElement.Foreground)}" Geometry="{StaticResource Geometry/Icon.Delete}"/>
</DrawingImage>
</asControls:Image>
</Button>
<Button Classes="InPlaceAction_Button" Command="{Binding $parent[UserControl].EditConditionCommand}" CommandParameter="{Binding $parent[ListBoxItem]}" ToolTip.Tip="{DynamicResource String/Common.Edit}">
<Button Classes="InPlaceAction_Button" Command="{Binding #root.EditConditionCommand}" CommandParameter="{Binding $parent[ListBoxItem]}" ToolTip.Tip="{DynamicResource String/Common.Edit}">
<asControls:Image Classes="InPlaceAction_Icon">
<DrawingImage>
<GeometryDrawing Brush="{Binding $parent[ListBoxItem].Foreground}" Geometry="{StaticResource Geometry/Icon.Edit}"/>
<GeometryDrawing Brush="{Binding #itemRoot.(TextElement.Foreground)}" Geometry="{StaticResource Geometry/Icon.Edit}"/>
</DrawingImage>
</asControls:Image>
</Button>
Expand All @@ -54,7 +50,7 @@
</asControls:ListBox.ItemTemplate>
</asControls:ListBox>
<Separator Classes="Dialog_Separator_Small" Grid.Row="1" IsVisible="{Binding #conditionListBox.IsVisible}"/>
<ToggleButton Name="addConditionButton" Classes="Dialog_Item_ToggleButton" Command="{Binding $parent[UserControl].ShowAddConditionMenu}" Grid.Row="2">
<ToggleButton Name="addConditionButton" Classes="Dialog_Item_ToggleButton" Command="{Binding #root.ShowAddConditionMenu}" Grid.Row="2">
<Grid ColumnDefinitions="*,Auto">
<TextBlock Classes="Button_TextBlock" Text="{DynamicResource String/Common.Add}"/>
<Panel Grid.Column="1">
Expand Down
15 changes: 5 additions & 10 deletions ULogViewer/Controls/KeyLogAnalysisRuleSetEditorDialog.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,10 @@
<TextBlock Classes="Dialog_TextBlock" Grid.Column="1" IsVisible="{Binding !#ruleListBox.IsVisible}" Text="{DynamicResource String/Common.None}"/>
</asControls:DialogItemGrid>
<Line Classes="Dialog_Item_Separator_Inner"/>
<asControls:ListBox Name="ruleListBox" Classes="Dialog_Item_ListBox" IsVisible="{Binding $parent[Window].Rules.Count}" ItemsSource="{Binding $parent[Window].Rules}">
<asControls:ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</asControls:ListBox.ItemsPanel>
<asControls:ListBox Name="ruleListBox" Classes="Dialog_Item_ListBox" IsVisible="{Binding $parent[Window].Rules.Count}" ItemsPanel="{StaticResource ItemsPanelTemplate/StackPanel}" ItemsSource="{Binding $parent[Window].Rules}">
<asControls:ListBox.ItemTemplate>
<DataTemplate>
<Grid ColumnDefinitions="Auto,*,Auto" RowDefinitions="Auto,Auto">
<Grid Name="itemRoot" ColumnDefinitions="Auto,*,Auto" RowDefinitions="Auto,Auto">
<Panel Classes="ListBoxItem_Icon">
<Image Classes="Icon" IsVisible="{Binding $parent[ListBoxItem].IsSelected}" Source="{Binding ResultType, Converter={x:Static appConverters:DisplayableLogAnalysisResultIconConverter.Default}, ConverterParameter=Light}"/>
<Image Classes="Icon" IsVisible="{Binding !$parent[ListBoxItem].IsSelected}" Source="{Binding ResultType, Converter={x:Static appConverters:DisplayableLogAnalysisResultIconConverter.Default}}"/>
Expand All @@ -90,21 +85,21 @@
<Button Classes="InPlaceAction_Button" Command="{Binding $parent[Window].RemoveRuleCommand}" CommandParameter="{Binding $parent[ListBoxItem]}" ToolTip.Tip="{DynamicResource String/Common.Delete}">
<asControls:Image Classes="InPlaceAction_Icon">
<DrawingImage>
<GeometryDrawing Brush="{Binding $parent[ListBoxItem].Foreground}" Geometry="{StaticResource Geometry/Icon.Delete}"/>
<GeometryDrawing Brush="{Binding #itemRoot.(TextElement.Foreground)}" Geometry="{StaticResource Geometry/Icon.Delete}"/>
</DrawingImage>
</asControls:Image>
</Button>
<Button Classes="InPlaceAction_Button" Command="{Binding $parent[Window].CopyRuleCommand}" CommandParameter="{Binding $parent[ListBoxItem]}" ToolTip.Tip="{DynamicResource String/Common.Copy}">
<asControls:Image Classes="InPlaceAction_Icon">
<DrawingImage>
<GeometryDrawing Brush="{Binding $parent[ListBoxItem].Foreground}" Geometry="{StaticResource Geometry/Icon.Copy}"/>
<GeometryDrawing Brush="{Binding #itemRoot.(TextElement.Foreground)}" Geometry="{StaticResource Geometry/Icon.Copy}"/>
</DrawingImage>
</asControls:Image>
</Button>
<Button Classes="InPlaceAction_Button" Command="{Binding $parent[Window].EditRuleCommand}" CommandParameter="{Binding $parent[ListBoxItem]}" ToolTip.Tip="{DynamicResource String/Common.Edit}">
<asControls:Image Classes="InPlaceAction_Icon">
<DrawingImage>
<GeometryDrawing Brush="{Binding $parent[ListBoxItem].Foreground}" Geometry="{StaticResource Geometry/Icon.Edit}"/>
<GeometryDrawing Brush="{Binding #itemRoot.(TextElement.Foreground)}" Geometry="{StaticResource Geometry/Icon.Edit}"/>
</DrawingImage>
</asControls:Image>
</Button>
Expand Down
Loading

0 comments on commit c88dbff

Please sign in to comment.