[英]How to resize all of the objects on my wpf form when window is set to maximize
[英]How to resize content when maximize window in WPF?
我有這個 window 並且我想調整內容的大小(適合 window 的大小)當用戶最大化這個 window 時,我嘗試了很多解決方案,但其中任何一個都對我有用:
<Window x:Class="Window_Image"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="550" d:DesignWidth="550">
<Grid>
<DockPanel LastChildFill="True" Name="ImgDock" Background="Transparent" >
<Image Source="../res/myimage.png" Width="450" Height="450" x:Name="ImageComp" Visibility="Visible" >
</Image>
</DockPanel>
</Grid>
我嘗試過的解決方案之一:
不幸的是,這個解決方案對我不起作用。
問題是Image
大小是硬編碼的( Height
和Width
屬性)。
默認情況下,大多數 WPF 組件將調整其大小以填充其容器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.