扩展器的标头值有问题 [英] problem with expander's header value

查看:53
本文介绍了扩展器的标头值有问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个wpf应用程序,里面有扩展器,在xaml部分中,我将标头的值绑定到数据库,如下所示:

< Expander Name ="_ expander"标头="{绑定位置级别}">

但是我的问题是在代码后面,当我想要获取标头的值时它没有给我值并且expander.hasheader为false,我不得不提到在运行时我可以看到标头的值,但是当我想要在代码后面获取值不会给出任何结果,我已经发现绑定存在问题,因为例如当我将标头更改为:Header ="Hello"时,我可以获取值,但是通过绑定我无法获取,有人可以指导我解决这个问题吗?非常感谢

Hi,I have a wpf application and inside that i have expander,in xaml part i''m binding the value for header to database as shown like this:

<Expander Name="_expander" Header="{Binding positionlevel}" >

but my problem is in code behind when i want to get the value of header it doesnt give me the value and the expander.hasheader is false,I have to mention that in run time i can see the value of header but when i want to get the value in code behind it gives nothing, i''ve already found out that the problem is with binding because for example when i change the header into : Header = "Hello",I can get the value but with binding I cannot,could anyone guide me please with this problem?thanks so much

推荐答案

BaharDev,

您可以使用Dispatcher线程获取要查找的扩展器的标头.喜欢,

Hi BaharDev,

You could use Dispatcher thread to get the header of the expander you are looking for. Like,

this.Loaded += (s, ee) =>
    {
        this.Dispatcher.BeginInvoke((Action)(() =>
            {
                MessageBox.Show(this._expander.Header.ToString());
            }));
    };


这篇关于扩展器的标头值有问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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