How do I make my controls inside a UserControl private?

后端 未结 1 553
隐瞒了意图╮
隐瞒了意图╮ 2020-12-30 20:43

I have a user control with a ComboBox and a TextBox. Everything is working great except I noticed that from my user control\'s instance object, I can access those two contr

相关标签:
1条回答
  • 2020-12-30 21:09

    You can use the x:FieldModifier attribute on your controls, thusly:

    <TextBox x:Name="textBox1" x:FieldModifier="private" />
    

    Interestingly the MSDN page for x:FieldModifier doesn't give "private" as a valid value for the attribute, but I've tested it and it works.

    0 讨论(0)
提交回复
热议问题