C# WPF DataBind boolean
Posted
by jtdangelo
on Stack Overflow
See other posts from Stack Overflow
or by jtdangelo
Published on 2010-03-15T03:22:28Z
Indexed on
2010/03/15
3:29 UTC
Read the original article
Hit count: 419
I have been using this website to learn a lot about C# for a while, but this is my first time posting a question. I look forward to hearing back from some of the seasoned C# veterans!
I have been working on a C# 4.0 WPF project and need to figure out how to databind a boolean value. I have a reference to my Application.Current object in a window. My "App" object contains a boolean field called "Downloaded" that is true if the user has downloaded information from a web service. I need to databind a textbox's IsEnabled field to this Downloaded value. Any tips? Here is what I have come up with so far. (Any useful links to better learn WPF XAML are greatly appreciated!)
C# Code:
class MainWindow : Window
{
...
private App MyApp = App.Current as App;
...
}
XAML:
<TextBox ... IsEnabled="{Binding Source=MyApp, Path=Downloaded}" />
James
© Stack Overflow or respective owner