如何更改用户控件的访问修饰符 [英] How to change the access modifier of a user control

查看:280
本文介绍了如何更改用户控件的访问修饰符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在XAML中创建用户控制,允许将其命名为查看。在View.xaml.cs我改变了访问修饰符的类视图内部:

I have a user control created in xaml, lets name it "View". In the View.xaml.cs I changed the access modifier for the class View to internal:

internal partial class View : ViewBase { ... }

更改访问修饰符的编译器状态错误后:

After changing the access modifier the compiler states the error:

ABView'的部分声明具有
冲突的访问修饰符

Partial declarations of 'A.B.View' have conflicting accessibility modifiers

我的第一个猜测是,鉴于有通过XAML代码进行内部。所以我加了XAML的两行:

My first guess was that the view has to be made internal via the xaml code. So I added two lines of xaml:

x:Name="View"
x:FieldModifier="internal"

但这并没有修复错误。我在哪里要改变访问修饰符,使视图内部

But this did not fix the error. Where do I have to change the access modifier to make a view internal?

推荐答案

类改性剂是通过X做?ClassModifier 。

The class modifier is done through "x:ClassModifier".

请参阅的http:// MSDN。 microsoft.com/en-us/library/ms754029.aspx 了解详情。

这篇关于如何更改用户控件的访问修饰符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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