WPF - 使用用户控件并设置设计时间高度和宽度

Mal*_*olm 4 wpf user-controls autosize

也许有人有这个答案.

我正在设计要添加到其他容器的用户控件,它们是为了适应容器的可用空间.

所以这意味着不设置用户控件的高度和宽度.

但是当我设计控件时,我希望看到它具有宽度和高度.

所以我当然不必继续设置和删除控件的wdth和高度

怎么办呢???

马尔科姆

Sau*_*ron 6

用这个

<UserControl x:Class="MyApp.UserControl1"
         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="500" d:DesignWidth="600">
Run Code Online (Sandbox Code Playgroud)