开发者

Can I create equivalent of C# attribute or metadata for WPF child controls in XAML code?

Can I add some kind of custom 开发者_如何学Pythonattributes in XAML ?


Perhaps you mean Attached properties (scroll down for info on how to create a custom one)? For examle "DockPanel.Dock" is an Attached property.

Or maybe Markup extensions? (though that is something a little bit different)

You can also place Attributes on custom controls and read them in code behind - just like any other .NET class, but that is not possible to do from XAML (since those are set per-type/method/..., not per-instance).


You can, using Attatched Properties. This lets you add your own and data to the xaml on any control you choose.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜