locked
How to open a popup without focused

    Question

  • I put some AppbarButtons on AppBar.When the first AppbarButton clicked, a Popup will be opened.And my question is other AppbarButtons don't response to 'First Clicked' event when the poppu is open.Maybe I wasn't clear.It's kinda like this.I click the first AppbarButton, the popup is open, and then I click the second AppbarButton.It will just close the popup and not response to the 'Click' on the second AppbarButton.

    Here is the codes of the popup in XAML.

    <Popup IsLightDismissEnabled="True" Margin="5"/>


    我是我,我非我。

    Thursday, September 25, 2014 5:02 AM

Answers

  • Hi Xijian Yan,

    First question, where you put your appbar button, inside the appbar or in the page?

    Let's say you have set IsLightDismissEnabled as true, it will capture all the mouse event to see if the popup need to be dismiss, to ensure this you could set a breakpoint in the appbar button click event, I believe you will not get this event fired.

    Here is some code I can reproduce the issue, button click event will not be fired:

    <Button Content="Button" HorizontalAlignment="Left" Height="164" Margin="786.985,331.657,0,0" VerticalAlignment="Top" Width="195" RenderTransformOrigin="2.309,0.499"

    Click="Button_Click" UseLayoutRounding="False" d:LayoutRounding="Auto"> </Button> <Popup IsOpen="True" IsLightDismissEnabled="True" VerticalOffset="100" HorizontalOffset="200" x:Name="StandardPopup"> <Border BorderBrush="{StaticResource ApplicationForegroundThemeBrush}" Background="{StaticResource ApplicationPageBackgroundThemeBrush}" BorderThickness="2" Width="200" Height="200"> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock Text="Simple Popup" FontSize="24.667" HorizontalAlignment="Center" /> <Button Content="Close" HorizontalAlignment="Center" /> </StackPanel> </Border> </Popup>


    If you put appbar button inside appbar, you should definitely get the event fire because appbar always in the front, that's why I ask you where you put your appbar button.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, September 26, 2014 2:20 AM
    Moderator