0

Good morning.

I would like to keep values in a class with public static assessors. For example:

public class Global
{
     public static string Information { get; set; }
     ...
}

And I want to change these values from UI level. I've tried do it this way:

<TextBox Text="{Binding Source={x:Static Member=local:Global.Information}}"/>

But there occurred an error:

Two-way binding requires Path or XPath.

I was looking for answer but every solution isn't working for me.

How can I bind static accessor from class with Text property?

Marcin
  • 17
  • 3
  • Now there is error: Expected 'Information' on type 'Global' to be an instance member. So still it isn't working. – Marcin Feb 28 '19 at 12:21
  • I misread that, sorry. Does [this](https://stackoverflow.com/questions/936304/binding-to-static-property) solve your problem? – devsmn Feb 28 '19 at 12:24

1 Answers1

0

Use this PropertyPath syntax for static properties, which is available since WPF 4.5:

Text="{Binding Path=(local:Global.Information)}"/>
Clemens
  • 123,504
  • 12
  • 155
  • 268