public TimerView() { InitializeComponent(); this.MaximizeToSecondaryMonitor(); ViewModel.Context = this; _viewModel = base.DataContext as TimerViewModel; }
public TimerView(TimerViewModel vm = null) { InitializeComponent(); SizeChanged += TimerAspectRatioLimits; if (vm != null) { DataContext = vm; } _vm = (TimerViewModel)DataContext; Loaded += (_, _) => { _window = Window.GetWindow(this) as TimerWindow; // This ensures the timer is a floating window if (_window != null) { InitializeFloatingWindow(); } TimerAspectRatioLimits(); }; }