我在網格中有一個網格和兩個邊界元素。當我縮小窗口時,外邊框消失了。有誰知道爲什麼以及如何防止它消失? 這裏是主窗口的佈局:當調整窗口大小時,帶負邊界的邊框消失
<Window x:Class="TestBorder.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TestBorder"
mc:Ignorable="d"
Title="MainWindow" Height="170" Width="225">
<Grid Margin="5" Height="100" VerticalAlignment="Top">
<Border BorderBrush="LightBlue" BorderThickness="5" Margin="-5"/>
<Border BorderBrush="Orange" BorderThickness="5"/>
</Grid>
</Window>
這裏是發生了什麼,當我調整它的大小:
外(藍色)的邊界是不可見的,如果我使窗口小。我知道可以解決它,但我想知道爲什麼會發生這種情況。
你想建立在WPF某種響應式佈局的。如果是所以,然後檢查這個問答:http://stackoverflow.com/questions/24909458/how-to-make-a-wpf-window-responsive – Hackerman