Use ListBoxItem taps to insert functions: remove inner Button from functions list template, keep item DataContext as FunctionDefinitionItem, and handle tap in code-behind by executing InsertFunctionCommand with the tapped item. Mirror history list clipboard pattern. Name flyout root for clarity.
This commit is contained in:
parent
ad8e178484
commit
8a5a50fcaa
2 changed files with 33 additions and 6 deletions
|
@ -135,7 +135,7 @@
|
|||
AutomationProperties.Name="Toggle functions panel">
|
||||
<Button.Flyout>
|
||||
<Flyout IsOpen="{Binding IsFunctionsPanelOpen, Mode=TwoWay}" Placement="BottomEdgeAlignedLeft">
|
||||
<Border Padding="8" MinWidth="360" MaxHeight="420">
|
||||
<Border x:Name="FunctionsPanelRoot" Padding="8" MinWidth="360" MaxHeight="420">
|
||||
<ScrollViewer>
|
||||
<StackPanel>
|
||||
<ItemsControl ItemsSource="{x:Static m:FunctionDefinitionItem.DefinedFunctionGroups}">
|
||||
|
@ -155,10 +155,7 @@
|
|||
<ListBox ItemsSource="{Binding Functions}" BorderThickness="0" SelectedIndex="-1">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate x:DataType="m:FunctionDefinitionItem">
|
||||
<Button
|
||||
Command="{Binding $parent[ListBox].DataContext.InsertFunctionCommand}"
|
||||
CommandParameter="{Binding}"
|
||||
Background="Transparent" BorderThickness="0" Padding="8" MinHeight="36"
|
||||
<Border Background="Transparent" Padding="8" MinHeight="36"
|
||||
AutomationProperties.Name="Insert function">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<StackPanel>
|
||||
|
@ -166,7 +163,7 @@
|
|||
<TextBlock Text="{Binding FunctionDescription}" Opacity="0.8"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Button>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue