public FlyoutWindow(FlyoutViewModel flyoutViewModel) { InitializeComponent(); _viewModel = flyoutViewModel; _viewModel.StateChanged += ViewModel_OnStateChanged; _viewModel.WindowSizeInvalidated += ViewModel_WindowSizeInvalidated; _viewModel.ExpandCollapse = new RelayCommand(() => { _needsExpandOrCollapse = true; _viewModel.BeginClose(); }); DataContext = _viewModel; Deactivated += FlyoutWindow_Deactivated; SourceInitialized += FlyoutWindow_SourceInitialized; Microsoft.Win32.SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; Closing += FlyoutWindow_Closing; this.FlowDirection = SystemSettings.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight; // Ensure the Win32 and WPF windows are created to fix first show issues with DPI Scaling Show(); Hide(); this.ApplyExtendedWindowStyle(User32.WS_EX_TOOLWINDOW); _viewModel.ChangeState(FlyoutViewModel.ViewState.Hidden); }
public FlyoutWindow(FlyoutViewModel flyoutViewModel) { InitializeComponent(); _viewModel = flyoutViewModel; _viewModel.StateChanged += ViewModel_OnStateChanged; _viewModel.WindowSizeInvalidated += ViewModel_WindowSizeInvalidated; _viewModel.ExpandCollapse = new RelayCommand(() => { _needsExpandOrCollapse = true; _viewModel.BeginClose(); }); DataContext = _viewModel; if (Features.IsEnabled(Feature.DevicePopup)) { Application.Current.Deactivated += FlyoutWindow_Deactivated; } else { Deactivated += FlyoutWindow_Deactivated; } SourceInitialized += FlyoutWindow_SourceInitialized; Microsoft.Win32.SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; Closing += FlyoutWindow_Closing; this.FlowDirection = SystemSettings.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight; // Ensure the Win32 and WPF windows are created to fix first show issues with DPI Scaling Show(); Hide(); _viewModel.ChangeState(FlyoutViewModel.ViewState.Hidden); }
private void FlyoutWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { // Disable Alt+F4 because we hide instead. e.Cancel = true; _viewModel.BeginClose(); }
private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e) { // Disable Alt+F4. e.Cancel = true; _viewModel.BeginClose(InputType.Keyboard); }