0
這是我想要實現的:彈出對圖像翻轉
我有一系列指示各種系統狀態的小圖像(24x24)。當用戶翻轉圖像時(例如系統警報圖像),我想要一個彈出窗口來顯示前5個警報和一個更多...選項(如果有超過5個警報)。在列表顯示時,我希望用戶能夠選擇其中一個警報或更多選項並顯示詳細信息。
我遇到的問題是:
我不能阻止彈出窗口,當鼠標離開圖像選擇項目消失。
這是我用來顯示彈出窗口的用戶控件中的一段XAML。
<Image x:Name="SmallImage"
Source="{Binding ElementName=root, Path=ImageSource}"
Height="{Binding ElementName=root, Path=Height}"
Width="{Binding ElementName=root, Path=Width}"
Grid.Row="0" />
<Popup Name="ItemPopup"
AllowsTransparency="True"
PopupAnimation="Fade"
HorizontalOffset="-35"
VerticalOffset="0"
Grid.Row="1">
<Popup.Style>
<Style TargetType="{x:Type Popup}">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=SmallImage, Path=IsMouseOver, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Value="True">
<DataTrigger.Setters>
<Setter Property="IsOpen" Value="True" />
</DataTrigger.Setters>
</DataTrigger>
</Style.Triggers>
</Style>
</Popup.Style>
<Border x:Name="MyBorder" BorderBrush="#72777F" Background="White" BorderThickness="1,1,1,1" CornerRadius="5,5,5,5">
<Grid>
<Label Content="This is your list of items."></Label>
</Grid>
</Border>
</Popup>
這將與他已有的觸發器一樣,如果他移動圖像的鼠標IsMouseOver將變爲false並將IsOpen設置爲False。 –
你是絕對正確的..不知道我在想什麼.. :)所以需要兩個觸發器,因爲在我更新的答案 – Nitin
這確實回答了我的問題,但是,有其他問題,我遇到試圖獲得彈出關閉並重新顯示。我使用事件處理程序來設置IsOpen屬性。 – Dave