Use single tap handler for functions flyout: add named Flyout with Opened/Closed handlers, remove per-row Tapped, and attach handler to flyout root at runtime. Handler finds tapped ListBoxItem and executes InsertFunctionCommand.

This commit is contained in:
Codex CLI 2025-08-28 04:25:36 -05:00
commit 3985395141
2 changed files with 50 additions and 4 deletions

View file

@ -134,7 +134,11 @@
<Button Grid.Column="1" Command="{Binding ToggleFunctionsCommand}" Margin="0,0,6,0" MinHeight="40" MinWidth="40"
AutomationProperties.Name="Toggle functions panel">
<Button.Flyout>
<Flyout IsOpen="{Binding IsFunctionsPanelOpen, Mode=TwoWay}" Placement="BottomEdgeAlignedLeft">
<Flyout x:Name="FunctionsFlyout"
IsOpen="{Binding IsFunctionsPanelOpen, Mode=TwoWay}"
Placement="BottomEdgeAlignedLeft"
Opened="OnFunctionsFlyoutOpened"
Closed="OnFunctionsFlyoutClosed">
<Border x:Name="FunctionsPanelRoot" Padding="8" MinWidth="360" MaxHeight="420">
<ScrollViewer>
<StackPanel>
@ -156,7 +160,6 @@
<ListBox.ItemTemplate>
<DataTemplate x:DataType="m:FunctionDefinitionItem">
<Border Background="Transparent" Padding="8" MinHeight="36"
Tapped="OnFunctionsItemTapped"
AutomationProperties.Name="Insert function">
<Grid ColumnDefinitions="*,Auto">
<StackPanel>