2

I am trying to control the Topmost property of a prism popup window with a DataTrigger, so that when a button within the XAML file is pressed, the Topmost property is set to false. I am pretty new to WPF and am not sure what I need to do to get my binding to work.

Note that the IsModal property is set to false and I'd like to keep it that way, unless the IsModal feature could also be styled with a DataTrigger from the button.

Here's the prism Popup with the style and attempted trigger

    <prism:InteractionRequestTrigger SourceObject="{Binding DataBarChartRequest, Mode=OneWay}">
        <prism:PopupWindowAction IsModal="False" WindowStartupLocation="CenterScreen">
            <prism:PopupWindowAction.WindowStyle>
                <Style TargetType="{x:Type Window}">
                        <Setter Property="Topmost" Value="True"/>
                        <Setter Property="Height" Value="650"/>
                        <Setter Property="Width" Value="900"/>
                        <Setter Property="ResizeMode" Value="CanResize"/>
                        <Setter Property="ShowInTaskbar" Value="True"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding ElementName=StopButton, Path=IsPressed}" Value="True">
                            <Setter Property="Window.Topmost" Value="False" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </prism:PopupWindowAction.WindowStyle>
            <prism:PopupWindowAction.WindowContent>
                <local:DataBarChartNotificationView Width="NaN" Height="NaN" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
            </prism:PopupWindowAction.WindowContent>
        </prism:PopupWindowAction>
    </prism:InteractionRequestTrigger>

and here's the button

            <RibbonButton Label="Stop" 
                          x:Name="StopButton"
                          Command="{Binding StopSessionCommand}"
                          LargeImageSource ="{StaticResource SessionStopGray}" 
                          FontSize="12" 
                          FontWeight="Regular" 
                          Height="60" 
                          Margin="0,10,0,0" 
                          Foreground="White"/>

It seems as though, despite this InteractionRequestTrigger being in the same xaml file as my button, the prism popup cannot find this local source, or it simply won't work. Would like to know if I can style either the IsModal or Topmost property with the button in the XAML file as a DataTrigger or how to fix my binding to do so.

l_hirsh
  • 21
  • 2

0 Answers0