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

查看:260
本文介绍了继承自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.

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

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.aspx 1

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天全站免登陆