[英]How to access control in Code Behind that was 'created' in XAML
I have a control I 'created' in XAML that I want to access through the Code Behind. 我在XAML中创建了一个控件,我希望通过Code Behind访问它。
<wincontrols:LiveTileFrameElement Name="PendingAuthsFrame1" Text="Pending" />
this.PendingAuthsFrame1.Text = "334";
However, I get a Build Error on the second statement above stating MyApp.MainWindow does not contain a definition for 'PendingAuthsFrame1' and no extension method....
it keeps going but you get the idea I'm guessing. 但是,我在上面的第二个语句上得到了一个Build Error,说明
MyApp.MainWindow does not contain a definition for 'PendingAuthsFrame1' and no extension method....
它继续进行但是你得到了我猜的想法。
What am I missing or doing wrong? 我错过了什么或做错了什么?
Use x:Name
instead of Name
. 使用
x:Name
而不是Name
。 That should do the trick. 这应该够了吧。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.