protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); _model.ChildrenTreeChanged += (s, args) => { if (args.Change != ChildrenTreeChange.DirectChildrenChanged) { return; } if (_asyncRefreshCalled.HasValue && _asyncRefreshCalled.Value == args.Change) { return; } _asyncRefreshCalled = args.Change; Dispatcher.BeginInvoke(new Action(() => { _asyncRefreshCalled = null; UpdateChildren(); }), DispatcherPriority.Normal, null); }; this.SizeChanged += OnSizeChanged; }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); this._model.ChildrenTreeChanged += new EventHandler <ChildrenTreeChangedEventArgs>((object s, ChildrenTreeChangedEventArgs args) => { if (this._asyncRefreshCalled.HasValue && this._asyncRefreshCalled.Value == args.Change) { return; } this._asyncRefreshCalled = new ChildrenTreeChange?(args.Change); base.Dispatcher.BeginInvoke(new Action(() => { this._asyncRefreshCalled = null; this.UpdateChildren(); }), DispatcherPriority.Normal, null); }); base.LayoutUpdated += new EventHandler(this.OnLayoutUpdated); }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); _model.ChildrenTreeChanged += (s, args) => { if (_asyncRefreshCalled.HasValue && _asyncRefreshCalled.Value == args.Change) return; _asyncRefreshCalled = args.Change; Dispatcher.BeginInvoke(new Action(() => { _asyncRefreshCalled = null; UpdateChildren(); }), DispatcherPriority.Normal, null); }; this.LayoutUpdated += new EventHandler(OnLayoutUpdated); }