Static property changing is not work preparely in C# wpf project

126 Views Asked by At

I have a static class like this:

static class HelperUpdater
{
    private static double _hwidth = 40d;
    public static double HWidth
    {
        get { return _hwidth; }
        set { _hwidth = value; }
    }
}

and I have a Textbox that text of it bind to HWidth and a Rectangle that width of it bind to HWidth. how can change this project that when changing textbox value then change width of rectangle? Xaml I use is this:

        <Canvas>
        <TextBox Text="{Binding Path=(local:HelperUpdater.HWidth),Mode=TwoWay}" Width="100"/>
        <TextBox Text="" Width="100" Canvas.Top="30"/>
        <Rectangle Stroke="Black" Fill="Red" StrokeThickness="2" Canvas.Left="10" Canvas.Top="100" Height="50"
                   Width="{Binding Path=(local:HelperUpdater.HWidth)}"/>
    </Canvas>
0

There are 0 best solutions below