data binding - WPF - How to bind to a Dependency Property of custom class -


I'm once again in WPF binding hell :) I have a public class ( treatment ) Is as follows:

  Treatment of public class () {... public ticker socktime real; ...}  

inside ticker is a dependency property:

  public class ticker: framework element {// value string As shown in the Dependency Property for public static reading, IntervalProperty = DependencyPrint. Registrar ("display interval", typef (string), typef (ticker, blank); Public String Display Interval {get {return (string) GetValue (DisplayIntervalProperty); } Set {Set Value (DisplayIntervalProperty, value); }} ...}  

In my app, a single treatment object has been created and should be easily accessible in XAMML ( app). Xaml ):

  & lt; Application Resources & gt; & Lt; ResourceDictionary & gt; & Lt; U: treatment x: key = "current treatment" /> & Lt; / ResourceDictionary & gt; & Lt; /Application.Resources>  

Now, I need to bind the dependency property SoakTimeActual on DisplayInterval to display this code in the current state. Here's my attempt, which does not work:

  & lt; TextBlock Text = "{binding source = {StaticResource currentTreatment}, path = SoakTimeActual.DisplayInterval}" />  

This is absolutely fine, but will not display anything. I am assuming that I have made a mistake with notice of change or DataContext or both.

Any insights is appreciated!

WPF binding works only on properties, not fields.

Therefore, you need to change your succintactive edit field to a property such as:

  Treatment of public class {... public Ticker Socktime Real {Received; Set; } ...}  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -