void StageControl_SizeChanged(object sender, SizeChangedEventArgs e) { if (StageVm == null) { return; } Dispatcher.BeginInvoke( DispatcherPriority.Normal, new Action(() => { Width = ActualHeight * StageVm.WidthToHeight(); InvalidateVisual(); })); }
protected override void OnRender(DrawingContext dc) { if (StageVm == null) { return; } Width = ActualHeight * StageVm.WidthToHeight(); dc.DrawRectangle(StageVm.StageVmStyle.BackgroundBrush, null, new Rect(0.0, 0.0, ActualWidth, ActualHeight)); dc.DrawKeyLines(StageVm.StageVmStyle, ActualWidth, ActualHeight); foreach (var kvm in StageVm.KeyPairVms) { dc.DrawSwitch(StageVm.StageVmStyle, StageVm.Order, kvm, ActualWidth, ActualHeight); } dc.DrawSortableValuesAnimate(StageVm.SortableVm, ActualWidth, ActualHeight); }