Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 private void FlyoutWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     // Disable Alt+F4 because we hide instead.
     e.Cancel = true;
     _viewModel.BeginClose();
 }
Ejemplo n.º 4
0
 private void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     // Disable Alt+F4.
     e.Cancel = true;
     _viewModel.BeginClose(InputType.Keyboard);
 }