0

Is there any GOOD way to bind a static property of static class in a two way mode?

Here is an example class:

 static class SettingsModel
 {
        static public string ModelFolder { set; get; }
 }

And a text box:

<TextBox x:Name="ModelTB" Text="{Binding Source={x:Static local:SettingsModel.ModelFolder}, Mode=TwoWay, Path=???/>

I've been searching for a lot and I've found only 2 not really good answers: Make class not static or create a dummy window resource class.

Keltar Helviett
  • 638
  • 1
  • 7
  • 13
  • [Binding to static property](https://stackoverflow.com/questions/936304/binding-to-static-property) – Lei Yang Jul 14 '17 at 05:57
  • You want [this answer](https://stackoverflow.com/a/7515926) in the marked duplicate, as it shows how to do this without intermediate objects. – Peter Duniho Jul 14 '17 at 06:58
  • I've added another duplicate which explains how you would do it since WPF 4.5 – Clemens Jul 14 '17 at 07:02

0 Answers0