Reputation: 619
I have this Flayout when I clic on the button "btn7":
<Button HorizontalAlignment="Stretch" Background="Transparent" x:Name="btn7" >
<Button.Flyout>
<Flyout Placement="Right" x:Name="FlayoutLo" >
<Grid VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Margin="10" Width="250">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBox x:Name="tt" VerticalAlignment="Bottom" Grid.Row="0" ></TextBox>
<Button Width="120" FontWeight="Normal" Content="Enregistrer" Background="#393185" Foreground="white" Margin="0,20,0,0" x:Name="SecondBtn" Grid.Row="1" />
</Grid>
</Flyout>
</Button.Flyout>
</Button>
I have an other Button,that I want to show the same Flyout at the same placement like the button "btn7" but whith C#,I have tried this:
private void MenuButton_Click(object sender, RoutedEventArgs e)
{
FlayoutLo.ShowAt(btn7);
}
but I get nothing when I clic on "MenuButton",how can I solve this problem thanks for help
Upvotes: 0
Views: 84
Reputation: 1353
I reproduced your issue using your code and I solved the problem with this code
if (btn7.Flyout != null)
{
var flyout = btn7.Flyout;
flyout.ShowAt(btn7);
}
I hope this would be useful for you.
Upvotes: 1