File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed
Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -187,16 +187,24 @@ public bool ClassicMode
187187 public ComboBoxPopup ( )
188188 {
189189 CustomPopupPlacementCallback = ComboBoxCustomPopupPlacementCallback ;
190+ var childPropertyDescriptor = DependencyPropertyDescriptor . FromProperty ( ComboBoxPopup . ChildProperty , typeof ( ComboBoxPopup ) ) ;
191+ EventHandler childChangedHandler = ( sender , x ) =>
192+ {
193+ if ( PopupPlacement != ComboBoxPopupPlacement . Undefined )
194+ {
195+ UpdateChildTemplate ( PopupPlacement ) ;
196+ }
197+ } ;
190198
191- DependencyPropertyDescriptor . FromProperty ( ComboBoxPopup . ChildProperty , typeof ( ComboBoxPopup ) )
192- . AddValueChanged ( this ,
193- delegate
194- {
195- if ( PopupPlacement != ComboBoxPopupPlacement . Undefined )
196- {
197- UpdateChildTemplate ( PopupPlacement ) ;
198- }
199- } ) ;
199+ Loaded += ( sender , args ) =>
200+ {
201+ childPropertyDescriptor . AddValueChanged ( this , childChangedHandler ) ;
202+ } ;
203+
204+ Unloaded += ( sender , args ) =>
205+ {
206+ childPropertyDescriptor . RemoveValueChanged ( this , childChangedHandler ) ;
207+ } ;
200208 }
201209
202210 private void SetupBackground ( IEnumerable < DependencyObject > visualAncestry )
You can’t perform that action at this time.
0 commit comments