1
在我的WPF应用程序中,我在MainWindow上有图像图标,并且在图像单击时显示/隐藏弹出窗口。在wpf中调整父窗口大小时弹出窗口在父窗口外面
弹出窗口的Placement属性是bottom,PlacementTarget设置为image。
问题 - 所有工作正常,但当我调整MainWindow的大小时,弹出窗口的一半超出了MainWindow。它必须在MainWindow的范围内。弹出式窗口只应显示在图像图标的底部。
我的弹出窗口代码...
<Popup Name="popup" AllowsTransparency="True"
Placement="Bottom" MouseDown="popup_MouseDown"
PlacementTarget="{Binding ElementName=TriangleIcon}">
<Border BorderThickness="3" BorderBrush="Gray"
Background="White" Height="150">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="3" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="3" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10"/>
<RowDefinition/>
<RowDefinition Height="10"/>
<RowDefinition/>
<RowDefinition Height="10"/>
<RowDefinition/>
<RowDefinition Height="10"/>
<RowDefinition/>
<RowDefinition Height="10"/>
<RowDefinition/>
<RowDefinition Height="
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" Grid.Column="1"
Grid.ColumnSpan="5" FontSize="15"
Foreground="Gray" HorizontalAlignment="Center">
Dashboard Settings </TextBlock>
<TextBlock Grid.Row="3" Grid.Column="1"
Grid.ColumnSpan="5" HorizontalAlignment="Left">
Local Rate : 12 $/kw. Click to change.</TextBlock>
<Button Width="50" Grid.Row="5" Grid.Column="1">Save</Button>
<Button Width="50" Grid.Row="7" Grid.Column="1">Print</Button>
<Button Width="50" Grid.Row="9"
Grid.Column="1">Log</Button>
</Grid>
</ScrollViewer>
</Border>
</Popup>
您是否试过这种解决方案? –
是的..谢谢你abhishek它的工作.. –
哦,太棒了,欢迎。 –