WPF中UserControl中DesignWidth和Width的区别

Difference between DesignWidth and Width in UserControl in WPF(WPF中UserControl中DesignWidth和Width的区别)

本文介绍了WPF中UserControl中DesignWidth和Width的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

When I create a new UserControl in WPF, studio creates some XAML:

<UserControl x:Class="MOG.Objects.Date.Calender"
             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="300" d:DesignWidth="300">

    <Grid>

    </Grid>
</UserControl>

In UserContol I can also add Width property. What is difference between DesignWidth and Width?

解决方案

d:DesignHeight and d.DesignWidth are for the Designer (the WYSIWYG), in Visual Studio or in Expression Blend. Height and Width are actually for runtime.

这篇关于WPF中UserControl中DesignWidth和Width的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:WPF中UserControl中DesignWidth和Width的区别

基础教程推荐