从 WPF 中的 UserControl 继承 [英] Inheriting from a UserControl in WPF

查看:43
本文介绍了从 WPF 中的 UserControl 继承的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 WPF 还很陌生,但在从用户控件继承时遇到了问题.

I am fairly new to WPF and I am having a problem with inheriting from a user control.

我创建了一个用户控件,现在我需要继承该控件并添加更多功能.

I created a User Control and now I need to inherit from that control and add some more functionality.

以前有人做过这种事吗?任何帮助将不胜感激.

Has anyone does this sort of thing before? Any help would be greatly appreciated.

谢谢

推荐答案

AFAIK 你不能继承 xaml,你只能继承后面的代码.

AFAIK you cannot inherit the xaml, you can only inherit the code behind.

我们最近在我们的项目中遇到了同样的问题.我们最终解决问题的方法是创建一个用户控件并将其添加到子"用户控件中.

We recently encountered the same problem on our project. The way we ended up solving our problem was to create a usercontrol and adding it to the "child" usercontrol.

如果这不起作用/帮助看看这个:http://geekswithblogs.net/lbugnion/archive/2007/03/02/107747.aspx1

If that doesnt work/help take a look at this: http://geekswithblogs.net/lbugnion/archive/2007/03/02/107747.aspx1

这篇关于从 WPF 中的 UserControl 继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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