/// public KPopup(WS style = WS.POPUP | WS.THICKFRAME, WSE exStyle = WSE.TOOLWINDOW | WSE.NOACTIVATE, bool shadow = false, SizeToContent sizeToContent = default) { _style = style; _exStyle = exStyle; _shadow = shadow; _sizeToContent = sizeToContent; }
/// <summary> /// Loads the window placement from the registry. /// </summary> /// <param name="window">The window.</param> /// <param name="name">The name.</param> private static void LoadFromRegistry(Window window, string name) { if (string.IsNullOrEmpty(name)) { return; } using (RegistryKey key = Registry.CurrentUser.OpenSubKey(name)) { if (key != null) { string prefix = window.GetType().Namespace + "." + window.GetType().Name; double left = Convert.ToDouble(key.GetValue(prefix + "_Left", window.Left)); double top = Convert.ToDouble(key.GetValue(prefix + "_Top", window.Top)); double width = Convert.ToDouble(key.GetValue(prefix + "_Width", window.Width)); double height = Convert.ToDouble(key.GetValue(prefix + "_Height", window.Height)); WindowState windowState = (WindowState)Convert.ToInt32(key.GetValue(prefix + "_WindowState", (int)window.WindowState)); SizeToContent sizeToContent = (SizeToContent)Convert.ToInt32(key.GetValue(prefix + "_SizeToContent", (int)window.SizeToContent)); Rectangle rectangle = new Rectangle((int)left, (int)top, (int)width, (int)height); if (IsVisibleWithinAnyScreen(rectangle)) { window.Left = left; window.Top = top; window.Height = height; window.Width = width; window.WindowState = windowState; window.SizeToContent = sizeToContent; } } } }
/// <summary> /// Provides derived classes an opportunity to handle changes to the SizeToContent property. /// </summary> protected virtual void OnSizeToContentChanged(SizeToContent oldValue, SizeToContent newValue) { if (_wpfContentHost != null) { _wpfContentHost.SizeToContent = newValue; } }
private void OnInitializedInternal(object sender, EventArgs e) { if (Equals(WindowChrome.GetWindowChrome(this), _chrome) && SizeToContent != SizeToContent.Manual) { _previousSizeToContent = SizeToContent; SizeToContent = SizeToContent.Manual; } }
public AppWindow(string name, object dataContext, SizeToContent sizeToContent = SizeToContent.WidthAndHeight, WindowStartupLocation startupLocation = WindowStartupLocation.CenterScreen) { Name = name; MContext = dataContext; SizeToContent = sizeToContent; WindowStartupLocation = startupLocation; this.Loaded += AppWindow_Loaded; InitializeComponent(); }
protected override int GenerateHashCode() { unchecked { int hashCode = Amount.GetHashCode(); hashCode = (hashCode * 397) ^ SizeToContent.GetHashCode(); hashCode = (hashCode * 397) ^ (int)Measure; return(hashCode); } }
void OnWindowLoaded(object sender, RoutedEventArgs e) { Loaded -= OnWindowLoaded; if (SizeToContent != SizeToContent.Manual) { SizeToContent oldValue = SizeToContent; SizeToContent = SizeToContent.Manual; SizeToContent = oldValue; } }
public WindowManagerWindowArgs(WindowStartupLocation windowStartupLocation, SizeToContent sizeToContent, bool allowTransparency, WindowStyle windowStyle, double opacity, bool topmost, bool showInTaskBar) { WindowStartupLocation = windowStartupLocation; SizeToContent = sizeToContent; AllowTransparency = allowTransparency; WindowStyle = windowStyle; Opacity = opacity; Topmost = topmost; ShowInTaskBar = showInTaskBar; }
protected override Size MeasureOverride(Size availableSize) { if (Display != null) { float clientW = (float)Display.ClientWidth; float clientH = (float)Display.ClientHeight; SizeToContent sizeToContent = SizeToContent; if (sizeToContent == SizeToContent.Manual) { base.MeasureOverride(new Size(clientW, clientH)); return(new Size(Width, Height)); } else { // calculate content desired size Size constraint = new Size( sizeToContent == SizeToContent.Height ? clientW : float.PositiveInfinity, sizeToContent == SizeToContent.Width ? clientH : float.PositiveInfinity); Size desiredSize = base.MeasureOverride(constraint); // adjust content size to window size (including borders) int desiredWidth = (int)Math.Ceiling(desiredSize.Width); int desiredHeight = (int)Math.Ceiling(desiredSize.Height); Display.AdjustWindowSize(ref desiredWidth, ref desiredHeight); // update window to the desired size if (sizeToContent != SizeToContent.Height) { Width = desiredWidth; } else { desiredWidth = (int)Width; } if (sizeToContent != SizeToContent.Width) { Height = desiredHeight; } else { desiredHeight = (int)Height; } return(new Size(desiredWidth, desiredHeight)); } } return(base.MeasureOverride(availableSize)); }
private void OnLoadedInternal(object sender, RoutedEventArgs e) { if (Equals(WindowChrome.GetWindowChrome(this), _chrome) && _previousSizeToContent != SizeToContent.Manual) { SizeToContent = _previousSizeToContent; _previousSizeToContent = SizeToContent.Manual; if (WindowStartupLocation == WindowStartupLocation.CenterScreen) { Left = SystemParameters.VirtualScreenLeft + SystemParameters.PrimaryScreenWidth / 2 - ActualWidth / 2; Top = SystemParameters.VirtualScreenTop + SystemParameters.PrimaryScreenHeight / 2 - ActualHeight / 2; } if (WindowStartupLocation == WindowStartupLocation.CenterOwner) { if (Owner != null) { if (Owner.WindowState == WindowState.Maximized) { var source = PresentationSource.FromVisual(Owner); if (source != null && source.CompositionTarget != null) { var ownerHandle = new WindowInteropHelper(Owner).EnsureHandle(); var ownerWindow = new Native.Window(ownerHandle); ownerWindow.Invalidate(); Left = -ownerWindow.NonClientBorderWidth * source.CompositionTarget.TransformFromDevice.M11; Top = -ownerWindow.NonClientBorderHeight * source.CompositionTarget.TransformFromDevice.M22; } else { Left = 0; Top = 0; } } else { Left = Owner.Left; Top = Owner.Top; } Left += Owner.ActualWidth / 2 - ActualWidth / 2; Top += Owner.ActualHeight / 2 - ActualHeight / 2; } } UpdateNonClientBorder(); if (_dispatcherFrame != null) { _dispatcherFrame.Continue = false; } } }
private void AssociatedObject_SourceInitialized(object sender, EventArgs e) { this.handle = (new WindowInteropHelper(base.AssociatedObject)).Handle; this.hwndSource = HwndSource.FromHwnd(this.handle); if (this.hwndSource != null) { this.hwndSource.AddHook(new HwndSourceHook(this.WindowProc)); } if (base.AssociatedObject.ResizeMode != ResizeMode.NoResize) { SizeToContent sizeToContent = base.AssociatedObject.SizeToContent; bool snapsToDevicePixels = base.AssociatedObject.SnapsToDevicePixels; base.AssociatedObject.SnapsToDevicePixels = true; base.AssociatedObject.SizeToContent = (sizeToContent == SizeToContent.WidthAndHeight ? SizeToContent.Height : SizeToContent.Manual); base.AssociatedObject.SizeToContent = sizeToContent; base.AssociatedObject.SnapsToDevicePixels = snapsToDevicePixels; } }
public void UpdateScale(double scaleX, double scaleY, bool resize) { if (VisualChildrenCount > 0) { GetVisualChild(0).SetValue(LayoutTransformProperty, new ScaleTransform(scaleX, scaleY)); } if (resize) { SizeToContent _autosize = SizeToContent; SizeToContent = SizeToContent.Manual; base.Width = _originalWidth * scaleX; base.Height = _originalHeight * scaleY; SizeToContent = _autosize; } }
public void ChangeWindowState(WindowViewStates states) { var toState = states.GetEnum <WindowState>(); switch (toState) { case WindowState.Maximized: this._beforeMaximizedSizeToContent = this.SizeToContent; this.SizeToContent = SizeToContent.Manual; break; case WindowState.Normal: case WindowState.Minimized: this.SizeToContent = this._beforeMaximizedSizeToContent; break; } this.WindowState = toState; }
private void store() { Owner = Window.Owner; actualWidth = Window.ActualWidth; actualHeight = Window.ActualHeight; minWidth = Window.MinWidth; minHeight = Window.MinHeight; glowBrush = Window.GlowBrush; background = Window.Background; windowStyle = Window.WindowStyle; resizeMode = Window.ResizeMode; sizeToContent = Window.SizeToContent; showCloseButton = Window.ShowCloseButton; showIconOnTitleBar = Window.ShowIconOnTitleBar; showMaxRestoreButton = Window.ShowMaxRestoreButton; showMinButton = Window.ShowMinButton; showTitleBar = Window.ShowTitleBar; topmost = Window.Topmost; }
public ControlHostWindow(User user, Control element, SizeToContent sizeToContent, Boolean hideButtonBar = false) : base(user) { InitializeComponent(); if (element.MinWidth > 0) { this.MinWidth = element.MinWidth + 15; } if (element.MinHeight > 0) { this.MinHeight = element.MinHeight + 15; } this.Control = element; this.SizeToContent = sizeToContent; ControlHost.Children.Add(element); if (hideButtonBar) { buttonBar.Visibility = System.Windows.Visibility.Collapsed; grid.RowDefinitions[1].Height = new GridLength(0); } this.ChangeRegistered += new PendingChangedRegisteredHandler((source, a) => { btnApply.IsEnabled = true; }); this.ChangesCommitted += new PendingChangesCommittedHandler((source) => { btnApply.IsEnabled = false; }); btnSelect.Click += new RoutedEventHandler(btnSelect_Click); this.Closed += new EventHandler(ControlHostWindow_Closed); }
public static bool? Show(object content, string caption, SizeToContent sizeToContent, MessageBoxButton mboxButtons) { return Show(content, caption, sizeToContent, ResizeMode.CanResize, mboxButtons); }
public static bool? Show(object content, string caption, SizeToContent sizeToContent, ResizeMode resizeMode, MessageBoxButton mboxButtons) { var MB = new ZeroMessageBox(true); if (caption != null) MB.Title = caption; MB.Content = content; MB.ResizeMode = resizeMode; switch (mboxButtons) { case MessageBoxButton.OK: MB.btnCancel.Visibility = Visibility.Collapsed; break; case MessageBoxButton.YesNo: MB.btnCancel.Content = "No"; MB.btnAccept.Content = "Si"; break; } MB.SizeToContent = sizeToContent; object obj = Application.Current.Windows[0].Content; if (obj is Panel) Terminal.Instance.Client.ShowEnable(false); bool? res = MB.ShowDialog(); if (obj is Panel) Terminal.Instance.Client.ShowEnable(true); return res; }
public WindowSettingsBuilder SizeToContent(SizeToContent size = System.Windows.SizeToContent.WidthAndHeight) { settings.SizeToContent = size; return(this); }
private static bool IsValidSizeToContent(SizeToContent value) { return value == SizeToContent.Manual || value == SizeToContent.Width || value == SizeToContent.Height || value == SizeToContent.WidthAndHeight; }
private void OnSizeToContentChanged(SizeToContent sizeToContent) { // this call ends up throwing an exception if accessing // SizeToContent is not allowed VerifyApiSupported(); // Update HwndSource's SizeToContent. // HwndSource will only update layout if the value has changed. // // Adding check for IsCompositionTargetInvalid as part of the fix for WOSB 1453012 if (IsSourceWindowNull == false && IsCompositionTargetInvalid == false) { HwndSourceSizeToContent = sizeToContent; } }
/// <summary> /// 获取或设置一个值,该值指示窗口是否自动调整自身大小以适应其内容大小 /// </summary> /// <param name="sizeToContent"></param> /// <returns></returns> public DialogRequest SetSizeToContent(SizeToContent sizeToContent) { InnerWindow.SizeToContent = sizeToContent; return(this); }
private bool?OpenDialog(IDialogViewModel viewModel, string title, WindowState startState, SizeToContent sizeToContent, WindowStartupLocation startupLocation, Window owner) { LogWindow(owner); Window window = new Window() { WindowState = startState, Title = title, Content = viewModel, SizeToContent = sizeToContent }; window.Closed += WindowOnClosed; window.Owner = owner; window.WindowStartupLocation = startupLocation; viewModel.RegisterWindow(window); return(window.ShowDialog()); }
public Window OpenWindow(IViewModel viewModel, string title, WindowState startState, SizeToContent sizeToContent, WindowStartupLocation startupLocation, Action onClose) { if (!Application.Current.Dispatcher.CheckAccess()) { return(Application.Current.Dispatcher.Invoke(() => OpenWindow(viewModel, title, startState, sizeToContent, startupLocation, onClose))); } Window window = new Window() { WindowState = WindowState.Normal, Title = title, Content = viewModel, SizeToContent = sizeToContent, WindowStartupLocation = startupLocation }; if (startupLocation == WindowStartupLocation.CenterOwner && window != Application.Current.MainWindow) { window.Owner = Application.Current.MainWindow; } window.Closed += (sender, e) => { if (!(sender is Window sWindow)) { return; } onClose(); sWindow.Content = null; }; window.Show(); window.WindowState = startState; return(window); }
public Window OpenWindow(IViewModel viewModel, string title, WindowState startState, SizeToContent sizeToContent, WindowStartupLocation startupLocation) { if (!Application.Current.Dispatcher.CheckAccess()) { return(Application.Current.Dispatcher.Invoke(() => OpenWindow(viewModel, title, startState, sizeToContent, startupLocation))); } return(OpenWindow(viewModel, title, startState, sizeToContent, startupLocation, Application.Current.MainWindow)); }
public WindowSettingsBuilder SizeToContent(SizeToContent size = System.Windows.SizeToContent.WidthAndHeight) { settings.SizeToContent = size; return this; }
public ModalDialogWindowBehavior WithSizeToContent(SizeToContent size) { SizeToContent = size; return(this); }
public static bool? Show(object content, string caption, SizeToContent sizeToContent) { return Show(content, caption, sizeToContent, MessageBoxButton.OKCancel); }
public void CreateAndShowWindow(Type type, double?width, double?height, string title, ResizeMode mode, SizeToContent stc) { Window wind = null; if (type.IsSubclassOf(typeof(Window))) { wind = (Activator.CreateInstance(type) as Window); } else if (type.IsSubclassOf(typeof(UserControl))) { var cont = (Activator.CreateInstance(type) as UserControl); wind = new Window() { Content = cont }; } else { throw new InvalidOperationException("Could not resolve type to window or user control"); } wind.Height = height ?? wind.Height; wind.Width = width ?? wind.Width; wind.Title = title; wind.ResizeMode = mode; wind.SizeToContent = stc; wind.ShowDialog(); }
private void CompletionWindowOnSizeChanged(object sender, SizeChangedEventArgs args) { var oldSize = new System.Drawing.Size((int)args.PreviousSize.Width, (int)args.PreviousSize.Height); var newSize = new System.Drawing.Size((int)args.NewSize.Width, (int)args.NewSize.Height); Logger.DebugFormat("CompletionWindow.SizeChanged({0} => {1})", oldSize, newSize); if (oldSize.Equals(newSize)) { Logger.DebugFormat(" ignoring - size hasn't changed"); _ignoreSizeChange = false; return; } if (_ignoreSizeChange) { Logger.DebugFormat(" ignoring - flag set"); _ignoreSizeChange = false; // Now that we've set the final width and height of the window, we can auto-select the first completion item. // If we always auto-selected the first completion item every time a resize event occurred, the tooltip // would be incorrectly positioned because Avalon doesn't reposition it when the window size changes. SelectFirstItem(); _completionWindow.SetTimeout(window => RePositionToolTip(), 10); return; } _ignoreSizeChange = true; _maxHeight = (int)_completionWindow.MaxHeight; _sizeToContent = _completionWindow.SizeToContent; _completionWindow.MaxWidth = double.PositiveInfinity; _completionWindow.MaxHeight = double.PositiveInfinity; _completionWindow.SizeToContent = SizeToContent.WidthAndHeight; var fullWidth = _completionWindow.Width; var fullHeight = _completionWindow.Height; Logger.DebugFormat(" full size = {0}, {1}", fullWidth, fullHeight); _completionWindow.MaxHeight = _maxHeight; _completionWindow.SizeToContent = _sizeToContent; if (HasCompletions) { var newWidth = fullWidth; if (fullHeight > _maxHeight) { newWidth += SystemParameters.VerticalScrollBarWidth + RightPadding; } _completionWindow.Width = newWidth; RePositionToolTip(); } else { _completionWindow.Width = oldSize.Width; HideToolTip(); } }
public static void SetSizeToContent(DependencyObject dc, SizeToContent value) { dc.SetValue(SizeToContentProperty, value); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); StartupArguments = e.Args; try { #if !THREADED WindowSplash splashWindow = new WindowSplash(); _splashViewModel = new ViewModelWindowSplash(); splashWindow.DataContext = _splashViewModel; _splashViewModel.ProgressText = "Initialising..."; splashWindow.Show(); _mainWindow = new WindowMain(); _mainViewModel = new ViewModelWindowMain(); #else UpgradeSettings(); _threadSplashScreen = new Thread(ExecuteSplashScreen); _threadSplashScreen.SetApartmentState(ApartmentState.STA); _threadSplashScreen.Start(); _mainWindow = new WindowMain(); _mainViewModel = new ViewModelWindowMain(); bool mainWinShowInTaskbar = _mainWindow.ShowInTaskbar; SizeToContent mainWinSizeToContent = _mainWindow.SizeToContent; _mainWindow.ShowInTaskbar = false; _mainWindow.SizeToContent = SizeToContent.Manual; _mainWindow.WindowState = WindowState.Minimized; _mainWindow.Show(); #endif DispatcherHelper.DoEvents(); if (!_mainViewModel.Initialize()) { _mainWindow.Close(); } else { EventHandler handler = null; handler = delegate { _mainViewModel.RequestClose -= handler; _mainWindow.Close(); }; _mainViewModel.RequestClose += handler; _mainWindow.DataContext = _mainViewModel; App.Current.MainWindow = _mainWindow; #if !THREADED _mainWindow.Cursor = Cursors.Arrow; splashWindow.Close(); _mainWindow.Show(); #else _mainWindow.ShowInTaskbar = mainWinShowInTaskbar; _mainWindow.WindowState = WindowState.Normal; _mainWindow.SizeToContent = mainWinSizeToContent; #endif _mainWindow.Activate(); } } finally { if ((_threadSplashScreen != null) && _threadSplashScreen.IsAlive) { _threadSplashScreen.Abort(); } } }
public static IFluentItem <Window> SizeToContent(this IFluentItem <Window> fluentItem, SizeToContent mode) { fluentItem.Element.SizeToContent = mode; return(fluentItem); }
public Window OpenWindow(IViewModel viewModel, string title, WindowState startState, SizeToContent sizeToContent, WindowStartupLocation startupLocation, Window owner) { if (!Application.Current.Dispatcher.CheckAccess()) { return(Application.Current.Dispatcher.Invoke(() => OpenWindow(viewModel, title, startState, sizeToContent, startupLocation, owner))); } LogWindow(owner); Window window = new Window() { WindowState = WindowState.Normal, Title = title, Content = viewModel, SizeToContent = sizeToContent }; window.Closed += WindowOnClosed; window.Owner = owner; window.WindowStartupLocation = startupLocation; window.Show(); window.WindowState = startState; return(window); }
protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); SetChromeWindow(); _originalSizeToContent = this.SizeToContent; if (this.SizeToContent != SizeToContent.Manual) { _border.Measure(new System.Windows.Size(double.PositiveInfinity, double.PositiveInfinity)); System.Windows.Size size = _border.DesiredSize; this.SizeToContent = SizeToContent.Manual; if (_originalSizeToContent == SizeToContent.WidthAndHeight || _originalSizeToContent == SizeToContent.Width) { this.Width = size.Width; } if (_originalSizeToContent == SizeToContent.WidthAndHeight || _originalSizeToContent == SizeToContent.Height) { this.Height = size.Height; } this.SizeToContent = _originalSizeToContent; } System.Drawing.Graphics g = System.Drawing.Graphics.FromHwnd(IntPtr.Zero); if (this.WindowStartupLocation == WindowStartupLocation.CenterOwner && this.Owner != null && this.Owner.WindowState == WindowState.Normal) { IntPtr hWnd = new WindowInteropHelper(this.Owner).Handle; System.Windows.Forms.Screen s = System.Windows.Forms.Screen.FromHandle(hWnd); double newLeft = this.Owner.Left + this.Owner.Width / (double)2 - this.Width / (double)2; if (newLeft < s.WorkingArea.Left / (double)(g.DpiX / 96.0)) { this.Left = s.WorkingArea.Left / (double)(g.DpiX / 96.0); } else if (newLeft + this.Width > s.WorkingArea.Right / (double)(g.DpiX / 96.0)) { this.Left = s.WorkingArea.Right / (double)(g.DpiX / 96.0) - this.Width; } else { this.Left = newLeft; } double newTop = this.Owner.Top + this.Owner.Height / (double)2 - this.Height / (double)2; if (newTop < s.WorkingArea.Top / (double)(g.DpiY / 96.0)) { this.Top = s.WorkingArea.Top / (double)(g.DpiY / 96.0); } else if (newTop + this.Height > s.WorkingArea.Bottom / (double)(g.DpiY / 96.0)) { this.Top = s.WorkingArea.Bottom / (double)(g.DpiY / 96.0) - this.Height; } else { this.Top = newTop; } } else if (this.WindowStartupLocation != WindowStartupLocation.Manual) { IntPtr hWnd = new WindowInteropHelper(this).Handle; System.Windows.Forms.Screen s = System.Windows.Forms.Screen.FromHandle(hWnd); this.Left = (s.WorkingArea.Left + s.WorkingArea.Width / (double)2) / (double)(g.DpiX / 96.0) - this.Width / (double)2; this.Top = (s.WorkingArea.Top + s.WorkingArea.Height / (double)2) / (double)(g.DpiY / 96.0) - this.Height / (double)2; } }
public bool?OpenDialog(IDialogViewModel viewModel, string title, WindowState startState, SizeToContent sizeToContent, WindowStartupLocation startupLocation) => OpenDialog(viewModel, title, startState, sizeToContent, startupLocation, Application.Current.MainWindow);
public void Init(Display display, RenderContext renderContext, uint samples, bool ppaa, bool lcd) { Display = display; RenderContext = renderContext; Samples = samples; PPAA = ppaa; LCD = lcd; RenderFlags flags = (ppaa ? RenderFlags.PPAA : 0) | (lcd ? RenderFlags.LCD : 0); // Set display properties Display.SetTitle(Title); // Set display Location float left = Left; float top = Top; if (!float.IsNaN(left) && !float.IsNaN(top)) { Display.SetLocation((int)left, (int)top); } // Set display Size float width = Width; float height = Height; SizeToContent sizeToContent = SizeToContent; if (sizeToContent != SizeToContent.Manual) { Size contentSize = MeasureContent(); if (sizeToContent != SizeToContent.Height) { width = contentSize.Width; } if (sizeToContent != SizeToContent.Width) { height = contentSize.Height; } } if (!float.IsNaN(width) && !float.IsNaN(height)) { Display.SetSize((int)width, (int)height); } // Create View _view = GUI.CreateView(this); _view.SetFlags(flags); _view.SetTessellationMaxPixelError(TessellationMaxPixelError.HighQuality); _view.Renderer.Init(renderContext.Device); // Hook to display events Display.LocationChanged += OnDisplayLocationChanged; Display.SizeChanged += OnDisplaySizeChanged; Display.StateChanged += OnDisplayStateChanged; Display.FileDropped += OnDisplayFileDropped; Display.Activated += OnDisplayActivated; Display.Deactivated += OnDisplayDeactivated; Display.Closing += OnDisplayClosing; Display.Closed += OnDisplayClosed; Display.MouseMove += OnDisplayMouseMove; Display.MouseButtonDown += OnDisplayMouseButtonDown; Display.MouseButtonUp += OnDisplayMouseButtonUp; Display.MouseDoubleClick += OnDisplayMouseDoubleClick; Display.MouseWheel += OnDisplayMouseWheel; Display.KeyDown += OnDisplayKeyDown; Display.KeyUp += OnDisplayKeyUp; Display.Char += OnDisplayChar; Display.TouchMove += OnDisplayTouchMove; Display.TouchDown += OnDisplayTouchDown; Display.TouchUp += OnDisplayTouchUp; }
/// <summary> /// Sets the value of the SizeToContent attached property /// </summary> /// <param name="obj"><see cref="DependencyObject" /> with the attached property</param> /// <param name="value">The new value to set</param> public static void SetSizeToContent(DependencyObject obj, SizeToContent value) { obj.SetValue(SizeToContentProperty, value); }
public static void SetViewSizeToContent(DependencyObject element, SizeToContent value) { element.SetValue(ViewSizeToContentProperty, value); }