[英]How to change style of an WPF popup window
可能變體之一的示例:
<UniformGrid Rows="2" Columns="2">
<ToggleButton x:Name="toggleButton" Content="Some Element.
Click for Popup"/>
<Popup IsOpen="{Binding IsChecked, ElementName=toggleButton}"
PlacementTarget="{Binding ElementName=toggleButton, Mode=OneWay}"
AllowsTransparency="True">
<Grid>
<Path Fill="LightYellow" Stroke="LightGray">
<Path.Data>
<CombinedGeometry GeometryCombineMode="Union">
<CombinedGeometry.Geometry1>
<RectangleGeometry Rect="0,10 100,200"/>
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<RectangleGeometry Rect="40,0 20,20">
<RectangleGeometry.Transform>
<RotateTransform Angle="45" CenterX="40"/>
</RectangleGeometry.Transform>
</RectangleGeometry>
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
<TextBlock Text="Popup text" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Grid>
</Popup>
</UniformGrid>
第二種變體:
<CombinedGeometry GeometryCombineMode="Union">
<CombinedGeometry.Geometry1>
<!--Vertical offset by the height of the arrow-->
<RectangleGeometry Rect="0,30 100,200"/>
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<!--Arrow shape-->
<PathGeometry Figures="M0,30 L10,0 L20,30 Z">
<PathGeometry.Transform>
<!--Arrow position-->
<TranslateTransform X="30"/>
</PathGeometry.Transform>
</PathGeometry>
</CombinedGeometry.Geometry2>
</CombinedGeometry>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.