【发布时间】:2017-03-25 21:59:55
【问题描述】:
我有一个网格和网格内的两个边框元素。当我缩小窗口时,外边框消失。有人知道为什么以及如何防止它消失吗? 这是主窗口的布局:
<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 上构建某种响应式布局吗?如果是这样,请查看此问答:stackoverflow.com/questions/24909458/…