c# - Binding to a WPF hosted control's DependencyProperty in WinForms -
I have WinForms app, which are some elements that are hosting WPF user controls (using ElementHost ).
I want to be able to force your WinForm's control property ( Button.Enabled
) to a Custom DependencyProperty of organized WPF user controls ( SearchResults.IsAccountSelected
).
Is it possible to bind a System.Windows.Forms.Binding to manage a property by a DependencyProperty?
Since I know that System.Windows.Forms.Binding sees for InotifyPropertyChanged .PropertyChanged
Events - A property supported by a DependencyProperty automatically activates these events Or I will be able to implement and manage the sending of the PropertyChanged events manually
DependencyObject ,
INotifyPropertyChanged
, you will be if you adopt this way also apply to send PropertyChanged. Nu ts
Good luck I can not seem to resign Jaysmith's idea that the UserControl property may be bound to be the best way to take. MVVM is a better way in most cases. Exceptions are there, of course. DependencyObject
is OnPropertyChanged
method, so apply INotifyPropertyChanged
DependencyObject generated category in your For example:
Public class MyClass: HeaderedContentControl, INotifyPropertyChanged {Protected Override Zero OnPropertyChanged (DependencyPropertyChangedEventArgs e) {var Handler = PropertyChanged; If (handler! = Null) handler (this, new Property Changeed Event Case (E. Property Name)); Base.OnPropertyChanged (E); } Private Event PropertyChangedEventHandler PropertyChanged; }
Comments
Post a Comment