XAML Binding to property
Posted
by
imslavko
on Stack Overflow
See other posts from Stack Overflow
or by imslavko
Published on 2012-12-05T22:49:02Z
Indexed on
2012/12/05
23:03 UTC
Read the original article
Hit count: 129
I have check box in my XAML+C# Windows Store application. Also I have bool property: WindowsStoreTestApp.SessionData.RememberUser
which is public and static.
I want check box's property IsChecked
to be consistent (or binded, or mapped) to this bool property.
I tried this: XAML
<CheckBox x:Name="chbRemember1" IsChecked="{Binding Mode=TwoWay}"/>
C#
chbRemember1.DataContext = SessionData.RememberUser;
Code for property:
namespace WindowsStoreTestApp
{
public class SessionData
{
public static bool RememberUser { get; set; }
}
}
But it doesn't seem to work. Can you help me?
© Stack Overflow or respective owner