Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binding to static class property [duplicate]

I want to bind a textblock text to a property of a static class. Whenever the property value of the static class changes, it should reflect to the textblock which is on the other window or custom control.

like image 993
Vinod Maurya Avatar asked Oct 05 '10 09:10

Vinod Maurya


1 Answers

You can bind to ANY property on a static class using the x:Static markup extension but if thy do not implement any change tracking, it might cause errors on the refresh!

<TextBlock Text="{Binding Source={x:Static sys:Environment.MachineName}}" /> 
like image 113
rudigrobler Avatar answered Sep 24 '22 03:09

rudigrobler