C# WPF DataBind boolean
- by jtdangelo
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