/// <summary>Fires when the IsBorderless property changess</summary> /// <param name="d">The dependency object.</param> /// <param name="args">The <see cref="DependencyPropertyChangedEventArgs" /> instance containing the event data.</param> private static void IsBorderlessChanged(DependencyObject d, DependencyPropertyChangedEventArgs args) { var window = d as Window; if (window == null) { return; } if ((bool)args.NewValue) { window.WindowStyle = WindowStyle.None; window.ResizeMode = ResizeMode.NoResize; window.SourceInitialized += (o, e) => { if (!GetIsBorderless(window)) { return; } var handle = (new WindowInteropHelper(window)).Handle; var hwndSource = HwndSource.FromHwnd(handle); if (hwndSource != null) { hwndSource.AddHook(WindowHook); } }; } else { window.WindowStyle = (WindowStyle)WindowStyleProperty.GetMetadata(typeof(Window)).DefaultValue; window.ResizeMode = (ResizeMode)ResizeModeProperty.GetMetadata(typeof(Window)).DefaultValue; } }
static DialogWindow() { DefaultStyleKeyProperty.OverrideMetadata(typeof(DialogWindow), new FrameworkPropertyMetadata(typeof(DialogWindow))); ResizeModeProperty.OverrideMetadata(typeof(DialogWindow), new FrameworkPropertyMetadata(ResizeMode.NoResize, OnResizeModeChanged, OnCoerceResizeMode)); SizeToContentProperty.OverrideMetadata(typeof(DialogWindow), new FrameworkPropertyMetadata(SizeToContent.WidthAndHeight, OnSizeToContentChanged, OnCoerceSizeToContent)); WindowStateProperty.OverrideMetadata(typeof(DialogWindow), new FrameworkPropertyMetadata(WindowState.Normal, OnWindowStateChanged, OnCoerceWindowState)); }
static InfoCardWindowControl() { DefaultStyleKeyProperty.OverrideMetadata( typeof(InfoCardWindowControl), new FrameworkPropertyMetadata(typeof(InfoCardWindowControl))); VisibilityProperty.OverrideMetadata( typeof(InfoCardWindowControl), new FrameworkPropertyMetadata(Visibility.Collapsed)); DropShadowColorProperty.OverrideMetadata( typeof(InfoCardWindowControl), new FrameworkPropertyMetadata(Color.FromArgb(0x38, 0, 0, 0))); HasDropShadowProperty.OverrideMetadata( typeof(InfoCardWindowControl), new FrameworkPropertyMetadata(true)); WindowStyleProperty.OverrideMetadata( typeof(InfoCardWindowControl), new FrameworkPropertyMetadata(WindowStyle.None)); ResizeModeProperty.OverrideMetadata( typeof(InfoCardWindowControl), new FrameworkPropertyMetadata(ResizeMode.NoResize)); }
static DialogWindow() { WindowStyleProperty.OverrideMetadata(typeof(DialogWindow), new FrameworkPropertyMetadata(WindowStyle.None)); ShowActivatedProperty.OverrideMetadata(typeof(DialogWindow), new FrameworkPropertyMetadata(false)); ShowInTaskbarProperty.OverrideMetadata(typeof(DialogWindow), new FrameworkPropertyMetadata(false)); ResizeModeProperty.OverrideMetadata(typeof(DialogWindow), new FrameworkPropertyMetadata(ResizeMode.NoResize)); }
static CursorWindow() { TopmostProperty.OverrideMetadata(typeof(CursorWindow), new FrameworkPropertyMetadata(true)); WindowStyleProperty.OverrideMetadata(typeof(CursorWindow), new FrameworkPropertyMetadata(WindowStyle.None)); ResizeModeProperty.OverrideMetadata(typeof(CursorWindow), new FrameworkPropertyMetadata(ResizeMode.NoResize)); AllowsTransparencyProperty.OverrideMetadata(typeof(CursorWindow), new FrameworkPropertyMetadata(true)); ShowInTaskbarProperty.OverrideMetadata(typeof(CursorWindow), new FrameworkPropertyMetadata(false)); }
static PrecisePopupWindow() { DefaultStyleKeyProperty.OverrideMetadata(typeof(PrecisePopupWindow), new FrameworkPropertyMetadata(typeof(PrecisePopupWindow))); TopmostProperty.OverrideMetadata(typeof(PrecisePopupWindow), new FrameworkPropertyMetadata(true)); WindowStyleProperty.OverrideMetadata(typeof(PrecisePopupWindow), new FrameworkPropertyMetadata(WindowStyle.None)); ResizeModeProperty.OverrideMetadata(typeof(PrecisePopupWindow), new FrameworkPropertyMetadata(ResizeMode.NoResize)); ShowInTaskbarProperty.OverrideMetadata(typeof(PrecisePopupWindow), new FrameworkPropertyMetadata(false)); AllowsTransparencyProperty.OverrideMetadata(typeof(PrecisePopupWindow), new FrameworkPropertyMetadata(true)); }
static GlowWindow() { AllowsTransparencyProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(true)); BackgroundProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(Brushes.Transparent)); ResizeModeProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(ResizeMode.NoResize)); ShowActivatedProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(false)); ShowInTaskbarProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(false)); SnapsToDevicePixelsProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(true)); WindowStyleProperty.OverrideMetadata(typeof(GlowWindow), new FrameworkPropertyMetadata(WindowStyle.None)); }
static BlurWindow() { DefaultStyleKeyProperty.OverrideMetadata(typeof(BlurWindow), new FrameworkPropertyMetadata(typeof(BlurWindow))); ResizeModeProperty.OverrideMetadata(typeof(BlurWindow), new FrameworkPropertyMetadata(ResizeMode.CanMinimize)); WindowStyleProperty.OverrideMetadata(typeof(BlurWindow), new FrameworkPropertyMetadata(WindowStyle.None)); if (WindowsVersion.Is10) { AllowsTransparencyProperty.OverrideMetadata(typeof(BlurWindow), new FrameworkPropertyMetadata(true)); } }
static BorderWindow() { DefaultStyleKeyProperty.OverrideMetadata(typeof(BorderWindow), new FrameworkPropertyMetadata(typeof(BorderWindow))); WindowStyleProperty.OverrideMetadata(typeof(BorderWindow), new FrameworkPropertyMetadata(WindowStyle.None)); ShowInTaskbarProperty.OverrideMetadata(typeof(BorderWindow), new FrameworkPropertyMetadata(false)); AllowsTransparencyProperty.OverrideMetadata(typeof(BorderWindow), new FrameworkPropertyMetadata(true)); ShowActivatedProperty.OverrideMetadata(typeof(BorderWindow), new FrameworkPropertyMetadata(false)); ResizeModeProperty.OverrideMetadata(typeof(BorderWindow), new FrameworkPropertyMetadata(ResizeMode.NoResize)); BorderBrushProperty.OverrideMetadata(typeof(BorderWindow), new FrameworkPropertyMetadata(Brushes.DimGray)); // override to make border less visible initially for slow machines WidthProperty.OverrideMetadata(typeof(BorderWindow), new FrameworkPropertyMetadata(1d)); HeightProperty.OverrideMetadata(typeof(BorderWindow), new FrameworkPropertyMetadata(1d)); }
static FlyoutPaneWindow() { //This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class. //This style is defined in themes\generic.xaml DefaultStyleKeyProperty.OverrideMetadata(typeof(FlyoutPaneWindow), new FrameworkPropertyMetadata(typeof(FlyoutPaneWindow))); //AllowsTransparency slow down perfomance under XP/VISTA because rendering is enterely perfomed using CPU //Window.AllowsTransparencyProperty.OverrideMetadata(typeof(FlyoutPaneWindow), new FrameworkPropertyMetadata(true)); WindowStyleProperty.OverrideMetadata(typeof(FlyoutPaneWindow), new FrameworkPropertyMetadata(WindowStyle.None)); ShowInTaskbarProperty.OverrideMetadata(typeof(FlyoutPaneWindow), new FrameworkPropertyMetadata(false)); ResizeModeProperty.OverrideMetadata(typeof(FlyoutPaneWindow), new FrameworkPropertyMetadata(ResizeMode.NoResize)); BackgroundProperty.OverrideMetadata(typeof(FlyoutPaneWindow), new FrameworkPropertyMetadata(Brushes.Transparent)); }
static Window() { DefaultStyleKeyProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata(typeof(Window))); ResizeModeProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata(ResizeMode.CanResize)); ThemeColorBrushProperty = DependencyProperty.Register("ThemeColorBrush", typeof(SolidColorBrush), typeof(Window), new FrameworkPropertyMetadata(null)); WindowStartupLocationProperty = DependencyProperty.Register("WindowStartupLocation", typeof(WindowStartupLocation), typeof(Window), new FrameworkPropertyMetadata(WindowStartupLocation.CenterScreen)); SearchEvent = EventManager.RegisterRoutedEvent("Search", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(Window)); SearchboxVisibilityProperty = DependencyProperty.Register("SearchboxVisibility", typeof(Visibility), typeof(Window), new FrameworkPropertyMetadata(Visibility.Collapsed)); SearchboxValueProperty = DependencyProperty.Register("SearchboxValue", typeof(string), typeof(Window), new FrameworkPropertyMetadata(string.Empty)); SearchboxPlaceholderProperty = DependencyProperty.Register("SearchboxPlaceholder", typeof(string), typeof(Window), new FrameworkPropertyMetadata("Search")); ExtraButtonsProperty = DependencyProperty.Register("ExtraButtons", typeof(List <TitlebarButton>), typeof(Window), new FrameworkPropertyMetadata(null)); MenuBarProperty = DependencyProperty.Register("MenuBar", typeof(List <IMenuItem>), typeof(Window), new FrameworkPropertyMetadata(null)); ShowIconProperty = DependencyProperty.Register("ShowIcon", typeof(Visibility), typeof(Window), new FrameworkPropertyMetadata(Visibility.Visible)); }
static ChromeWindow() { AllowsTransparencyProperty.OverrideMetadata( typeof(ChromeWindow), new FrameworkPropertyMetadata(true)); ResizeModeProperty.OverrideMetadata( typeof(ChromeWindow), new FrameworkPropertyMetadata(ResizeMode.NoResize)); ShowActivatedProperty.OverrideMetadata( typeof(ChromeWindow), new FrameworkPropertyMetadata(false)); ShowInTaskbarProperty.OverrideMetadata( typeof(ChromeWindow), new FrameworkPropertyMetadata(false)); VisibilityProperty.OverrideMetadata( typeof(ChromeWindow), new FrameworkPropertyMetadata(Visibility.Collapsed)); WindowStyleProperty.OverrideMetadata( typeof(ChromeWindow), new FrameworkPropertyMetadata(WindowStyle.None)); }
static InfoCardWindow() { ShowInTaskbarProperty.OverrideMetadata( typeof(InfoCardWindow), new FrameworkPropertyMetadata(false)); SizeToContentProperty.OverrideMetadata( typeof(InfoCardWindow), new FrameworkPropertyMetadata(SizeToContent.WidthAndHeight)); WindowStyleProperty.OverrideMetadata( typeof(InfoCardWindow), new FrameworkPropertyMetadata(WindowStyle.None)); ResizeModeProperty.OverrideMetadata( typeof(InfoCardWindow), new FrameworkPropertyMetadata(ResizeMode.NoResize)); AllowsTransparencyProperty.OverrideMetadata( typeof(InfoCardWindow), new FrameworkPropertyMetadata(true)); BackgroundProperty.OverrideMetadata( typeof(InfoCardWindow), new FrameworkPropertyMetadata(Brushes.Transparent)); EventManager.RegisterClassHandler( typeof(InfoCard), InfoCard.PinnedEvent, (RoutedEventHandler)OnInfoCardPinned); EventManager.RegisterClassHandler( typeof(InfoCard), InfoCard.UnpinnedEvent, (RoutedEventHandler)OnInfoCardUnpinned); }
static MainWindow() { DefaultStyleKeyProperty.OverrideMetadata(typeof(MainWindow), new FrameworkPropertyMetadata(typeof(MainWindow))); ResizeModeProperty.OverrideMetadata(typeof(MainWindow), new FrameworkPropertyMetadata(ResizeMode.CanResize, OnResizeModeChanged, OnCoerceResizeMode)); }