落后于XAML“创造”如何访问在code控制 [英] How to access control in Code Behind that was 'created' in XAML

查看:159
本文介绍了落后于XAML“创造”如何访问在code控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的WPF,我有我的XAML创造一个控制,我想通过code访问落后。

I am new to WPF and I have a control I 'created' in XAML that I want to access through the Code Behind.

<wincontrols:LiveTileFrameElement Name="PendingAuthsFrame1" Text="Pending" />

this.PendingAuthsFrame1.Text = "334";

不过,我得到上面指出的第二条语句生成错误 MyApp.MainWindow不包含PendingAuthsFrame1的定义,并没有扩展方法...... 它不断去,但你的想法我猜。

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.

我在想什么或者做错了吗?

What am I missing or doing wrong?

推荐答案

使用 X:名称而不是名称 。这应该做的伎俩。

Use x:Name instead of Name. That should do the trick.

这篇关于落后于XAML“创造”如何访问在code控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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