如何创建WPF设计时的财产? [英] How to create design time property in WPF?

查看:112
本文介绍了如何创建WPF设计时的财产?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使我自己的用户控件与设计时间properies?我要像

How do I make my own UserControl with design time properies? I want functionality like

<MyControl MyNormalProperty="..." d:MyDesignProperty="..."></MyControl>



我注意到,在混合性质一样,与 MC使用:可忽略= D(忽略它们在运行时德宁XAML加载)和的xmlns:D =一些命名空间,但我无法弄清楚如何在隐藏文件用户控件我的代码定义这样的属性。

I noticed that in Blend properties like that are used with mc:Ignorable="d" (to ignore them durning XAML loading at runtime) and xmlns:d="some namespace", but I cannot figure out How to define such property in my code behind file for UserControl.

我大概可以做AttachedProperty这样

I could probably do AttachedProperty like this

<MyControl Whatever.MyDesignProperty="..."></MyControl>



不过,我希望更多的统一的解决办法。

But I was hoping for more uniform solution.

在此先感谢

推荐答案

看看这篇文章:的自定义设计时属性在Silverlight和WPF设计

这篇关于如何创建WPF设计时的财产?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆