How to change the access modifier of a user control

丶灬走出姿态 提交于 2019-12-08 14:45:52

问题


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:

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

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?


回答1:


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

See http://msdn.microsoft.com/en-us/library/ms754029.aspx for more information.




回答2:


because its a partial class, another file exists with the line;

public partial class View : ViewBase { ... }

you can search the file and change public to internal, it should solve the problem



来源:https://stackoverflow.com/questions/3957576/how-to-change-the-access-modifier-of-a-user-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!