Could someone please tell me how to display the path of the current working directory in a textbox using C# and WPF?
I don't understand how I can bind to it.
In ViewModel/View's code behind:
public string CurrentDirectoryPath
{
get
{
return Environment.CurrentDirectory;
}
}
In View's XAML:
<TextBox Text="{Binding CurrentDirectoryPath}" />
Setup right DataContext
// If you are using MVVM:
var view = new MyView { DataContext = new MyViewModel() };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With