Click here to Skip to main content
15,907,913 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

1 solution

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());
            }));
    };
 
Share this answer
 
v2
Comments
BaharDev 27-Sep-10 23:55pm    
Thank you so much for your answer it works:)
PumbaPumba 28-Sep-10 7:40am    
You are most welcome :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900