-
| I have a treeview with a context flyout. The flyout opens on a right-click in the treeview. | 
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
| If you get access to TreeView instance, you can do  | 
Beta Was this translation helpful? Give feedback.
-
| I guess you want to close that flyout from the command? If so, you need some way of Interaction. Ideas: 
 | 
Beta Was this translation helpful? Give feedback.
-
| Thanks to this thread I was able to find another solution for my needs without code-behind which looks also nice. If someone was looking for example with interactions, here it is: <UserControl
    xmlns:i="using:Avalonia.Xaml.Interactivity"
    xmlns:ib="using:Avalonia.Xaml.Interactions.Core"
    <TreeView.ContextFlyout>
        <Flyout FlyoutPresenterClasses="RoundedCorners">
            <Menu >
                <StackPanel>            
                    <Button Content="Connect"  Command="{Binding ConnectCommand}">
                        <i:Interaction.Behaviors>
                            <ib:EventTriggerBehavior EventName="Click">
                                <ib:CallMethodAction MethodName="Hide" TargetObject="{Binding $parent[TreeView].ContextFlyout}" />
                            </ib:EventTriggerBehavior>
                        </i:Interaction.Behaviors>
                    </Button>
                </StackPanel>
            </Menu>
        </Flyout>
    </TreeView.ContextFlyout>
</UserControl> | 
Beta Was this translation helpful? Give feedback.
If you get access to TreeView instance, you can do
TreeView.ContextFlyout.Hide()I believe.