Click here to Skip to main content
15,888,301 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

i am adding 2 custom dependency properties, for the one of type string everything works fine.

for the second one of type Boolean it did not work.
i tried to find the cause but it seems for me there is no error(i even tried to change the type to string, and when i did, it worked fine), is there a special way of binding boolean ?.
this the code i am using:
the view class:

C#
public static readonly DependencyProperty IsReadyProperty = DependencyProperty.Register("IsReady", typeof (Boolean),
                                                                                                typeof (
                                                                                                    ReportBuilderView),
                                                                                                new PropertyMetadata(
                                                                                                    IsReadyChanged));



C#
public Boolean IsReady
       {
           set
           {
               this.SetValue(IsReadyProperty, value);
           }
           get { return (Boolean)this.GetValue(IsReadyProperty); }
       }



C#
Binding myBinding2 = new Binding("IsReadyForQuerying");
            myBinding2.Source = viewModel.IsReadyForQuerying;
            myBinding2.Mode = BindingMode.TwoWay;
            BindingOperations.SetBinding(this, ReportBuilderView.IsReadyProperty, myBinding2);
            IsReady = false;


the view model part:

C#
private Boolean _isReady;
        public Boolean IsReadyForQuerying
        {
            get { return _isReady; }
            set
            {
                _isReady = value;
                this.RaisePropertyChanged(() => this.IsReadyForQuerying);
            }
        }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900