diff --git a/src/AdvancedCalculator/Views/MainView.axaml b/src/AdvancedCalculator/Views/MainView.axaml index e9b804d..5274b5a 100644 --- a/src/AdvancedCalculator/Views/MainView.axaml +++ b/src/AdvancedCalculator/Views/MainView.axaml @@ -136,9 +136,7 @@ + Placement="BottomEdgeAlignedLeft"> @@ -162,7 +160,7 @@ + Tapped="OnFunctionsItemTapped"> diff --git a/src/AdvancedCalculator/Views/MainView.axaml.cs b/src/AdvancedCalculator/Views/MainView.axaml.cs index 5a3bbd9..bb86741 100644 --- a/src/AdvancedCalculator/Views/MainView.axaml.cs +++ b/src/AdvancedCalculator/Views/MainView.axaml.cs @@ -21,7 +21,7 @@ public partial class MainView : UserControl private MainViewModel? _vm; private ListBox? _historyList; - private Border? _functionsPanelRoot; + // Functions flyout is handled via per-item Tapped in XAML private void OnAttachedToVisualTree(object? sender, VisualTreeAttachmentEventArgs e) { @@ -53,12 +53,6 @@ public partial class MainView : UserControl _historyList.RemoveHandler(InputElement.TappedEvent, OnHistoryTapped); _historyList = null; } - // Detach functions panel tap handler if still attached - if (_functionsPanelRoot is not null) - { - _functionsPanelRoot.RemoveHandler(InputElement.TappedEvent, OnFunctionsItemTapped); - _functionsPanelRoot = null; - } _vm = null; } @@ -104,23 +98,5 @@ public partial class MainView : UserControl } } - - private void OnFunctionsFlyoutOpened(object? sender, EventArgs e) -{ - if (sender is Flyout flyout && sender is ContentPresenter presenter) - { - _functionsPanelRoot = presenter.FindControl("FunctionsPanelRoot"); - _functionsPanelRoot?.AddHandler(InputElement.TappedEvent, OnFunctionsItemTapped, - RoutingStrategies.Tunnel | RoutingStrategies.Bubble); - } -} - - private void OnFunctionsFlyoutClosed(object? sender, EventArgs e) - { - if (_functionsPanelRoot is not null) - { - _functionsPanelRoot.RemoveHandler(InputElement.TappedEvent, OnFunctionsItemTapped); - _functionsPanelRoot = null; - } - } + // Removed Opened/Closed dynamic wiring; handled directly in XAML. }