I have a static property in my class like
public partial class ShellWindow
{
private static Visibility progressbarVisibility = Visibility.Collapsed;
public static Visibility ProgressbarVisibility
{
get { return progressbarVisibility; }
set
{
if (progressbarVisibility == value) return;
progressbarVisibility = value;
RaiseStaticPropertyChanged("ProgressbarVisibility");
}
}
public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
public static void RaiseStaticPropertyChanged(string propName)
{
EventHandler<PropertyChangedEventArgs> handler = StaticPropertyChanged;
if (handler != null)
handler(null, new PropertyChangedEventArgs(propName));
}
}
I am creating a control in code behind and wanted to bind it with this property. Currently i am doing like this
var binding = new Binding("ShellWindow.ProgressbarVisibility") { Mode = BindingMode.TwoWay };
binding.Source = this;
progressbar = new CircularProgressBar ();
progressbar.SetBinding(VisibilityProperty,
binding);
This binding is not working. I am tring to follow this article but i didn't get where i am doing wrong.