当前位置: 首页>>代码示例>>C#>>正文


C# Window.SetValue方法代码示例

本文整理汇总了C#中System.Windows.Window.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Window.SetValue方法的具体用法?C# Window.SetValue怎么用?C# Window.SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Window的用法示例。


在下文中一共展示了Window.SetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UnregisterWindowUsingAttachedProperty

        public void UnregisterWindowUsingAttachedProperty()
        {
            // ARRANGE
            var window = new Window();
            window.SetValue(DialogServiceViews.IsRegisteredProperty, true);
            
            // ACT
            window.SetValue(DialogServiceViews.IsRegisteredProperty, false);

            // ASSERT
            Assert.That(DialogServiceViews.Views, Is.Empty);
        }
开发者ID:402214782,项目名称:mvvm-dialogs,代码行数:12,代码来源:DialogServiceViewsTest.cs

示例2: AttachWindowListeners

		private static void AttachWindowListeners(Window window, object vm) {
			if(vm != null) {
				var listener = new WindowMessageListener(window);
				window.SetValue(WindowMessageListenerProperty, listener);
				listener.Attach(vm, window);

				window.DataContextChanged += window_DataContextChanged;
			}
		}
开发者ID:catwalkagogo,项目名称:Heron,代码行数:9,代码来源:MessageReceivers.WindowMessages.cs

示例3: DettachWindowListeners

		private static void DettachWindowListeners(Window window, object vm) {
			if(vm != null) {
				var listener = (WindowMessageListener)window.GetValue(WindowMessageListenerProperty);
				if(listener != null) {
					window.SetValue(WindowMessageListenerProperty, null);
					listener.Dettach(vm, window);
				}
			}
		}
开发者ID:catwalkagogo,项目名称:Heron,代码行数:9,代码来源:MessageReceivers.WindowMessages.cs

示例4: capture

        public bool capture(String path)
        {
            try
            {
                Thread newWindowThread = new Thread(new ThreadStart(() =>
                {
                    // Create and show the Window
                    mainWindow = new Window();
                    this.path = path;
                    this.makeDir();
                    Rectangle resolution = Screen.PrimaryScreen.Bounds;

                    mainWindow.WindowState = WindowState.Maximized;
                    mainWindow.WindowStyle = WindowStyle.None;
                    mainWindow.BorderThickness = new Thickness(0);
                    mainWindow.SizeToContent = SizeToContent.WidthAndHeight;

                    //mainWindow.SetValue() = new ScaleTransform()

                    mainWindow.SetValue(Window.LayoutTransformProperty, null);

                    //Generate Canvas
                    canvas = new Canvas();
                    canvas.Width = resolution.Width;
                    canvas.Height = resolution.Height;
                    canvas.Background = getImageBrush();

                    mainWindow.Content = canvas;
                    mainWindow.MouseDown += new System.Windows.Input.MouseButtonEventHandler(mouseDown);
                    mainWindow.MouseMove += new System.Windows.Input.MouseEventHandler(mouseMove);
                    mainWindow.MouseUp += new System.Windows.Input.MouseButtonEventHandler(mouseUp);

                    // always on top
                    mainWindow.Topmost = true;
                    mainWindow.Show();
                    // Start the Dispatcher Processing
                    System.Windows.Threading.Dispatcher.Run();
                }));

                newWindowThread.SetApartmentState(ApartmentState.STA);
                // Make the thread a background thread
                newWindowThread.IsBackground = true;
                // Start the thread
                newWindowThread.Start();

                CaptureTool.captureResetEvent.WaitOne();
            }
            catch(Exception)
            {

            }
            return true;
        }
开发者ID:PYO2016,项目名称:Client,代码行数:53,代码来源:CaptureTool.cs

示例5: EnsureHotkeyServiceHelper

        private static HotkeyServiceHelper EnsureHotkeyServiceHelper(Window window)
        {
            HotkeyServiceHelper helper = (HotkeyServiceHelper)window.GetValue(HotkeyServiceHelperPropertyKey.DependencyProperty);

            if (helper == null)
            {
                helper = new HotkeyServiceHelper(window);
                window.SetValue(HotkeyServiceHelperPropertyKey, helper);
            }

            return helper;
        }
开发者ID:JamesNK,项目名称:Newtonsoft.Googleman,代码行数:12,代码来源:HotkeyService.cs

示例6: _EnsureAttachedExtensions

        private static WindowExtensions _EnsureAttachedExtensions(Window window)
        {
            Assert.IsNotNull(window);

            var ext = (WindowExtensions)window.GetValue(WindowExtensionsProperty);
            if (ext == null)
            {
                ext = new WindowExtensions(window);
                window.SetValue(WindowExtensionsProperty, ext);
            }

            return ext;
        }
开发者ID:grandtiger,项目名称:wpf-shell,代码行数:13,代码来源:WindowExtensions.cs

示例7: SetPinned

 private static void SetPinned(Window window, bool value)
 {
     var interopHelper = new WindowInteropHelper(window);
     var handle = interopHelper.Handle;
     if (handle == IntPtr.Zero)
     {
         window.SetValue(IsPinnedProperty, value);
         window.Loaded += WindowLoaded;
         return;
     }
     if (value)
         PinToDesktop(handle);
     else
         UnpinFromDesktop(handle);
 }
开发者ID:WORawSon,项目名称:translucentdarkdisplay,代码行数:15,代码来源:WindowPinner.cs

示例8: RegisterWindowUsingAttachedProperty

        public void RegisterWindowUsingAttachedProperty()
        {
            // ARRANGE
            var window = new Window();

            var expected = new[]
            {
                new ViewWrapper(window)
            };

            // ACT
            window.SetValue(DialogServiceViews.IsRegisteredProperty, true);
            
            // ASSERT
            Assert.That(DialogServiceViews.Views, Is.EqualTo(expected));
        }
开发者ID:402214782,项目名称:mvvm-dialogs,代码行数:16,代码来源:DialogServiceViewsTest.cs

示例9: SetDialogResult

 public static void SetDialogResult(Window target, bool? value)
 {
     target.SetValue(DialogResultProperty, value);
 }
开发者ID:ariyair,项目名称:CMContrib,代码行数:4,代码来源:DialogCloser.cs

示例10: EnsureWindow

        /// <summary>
        /// Makes sure the view is a window is is wrapped by one.
        /// </summary>
        /// <param name="model">The view model.</param>
        /// <param name="view">The view.</param>
        /// <param name="isDialog">Whethor or not the window is being shown as a dialog.</param>
        /// <returns>The window.</returns>
        protected virtual Window EnsureWindow(object model, object view, bool isDialog)
        {
            var window = view as Window;

            if (window == null) {
                window = new Window {
                    Content = view,
                    SizeToContent = SizeToContent.WidthAndHeight
                };

                window.SetValue(View.IsGeneratedProperty, true);

                var owner = InferOwnerOf(window);
                if (owner != null)
                {
                    window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                    window.Owner = owner;
                }
                else
                {
                    window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                }
            }
            else
            {
                var owner = InferOwnerOf(window);
                if (owner != null && isDialog)
                    window.Owner = owner;
            }

            return window;
        }
开发者ID:alrabe,项目名称:CaliburnMicro,代码行数:39,代码来源:WindowManager.cs

示例11: SetIsEnabled

 public static void SetIsEnabled(Window window, bool value) {
     window.SetValue(IsEnabledProperty, value);
 }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:3,代码来源:MoveableWindowBehavior.cs

示例12: SetSettings

 public static void SetSettings(Window element, Settings value)
 {
     element.SetValue(SettingsProperty, value);
 }
开发者ID:thoemmi,项目名称:Solutionizer,代码行数:4,代码来源:WindowStatePersistence.cs

示例13: SetIsHiddenCloseButton

 private static void SetIsHiddenCloseButton(Window obj, bool value)
 {
     obj.SetValue(IsHiddenCloseButtonKey, value);
 }
开发者ID:rdingwall,项目名称:mixplanner,代码行数:4,代码来源:WindowBehavior.cs

示例14: SetIsClosingAsPartOfDragOperation

 internal static void SetIsClosingAsPartOfDragOperation(Window element, bool value)
 {
     element.SetValue(IsClosingAsPartOfDragOperationProperty, value);
 }
开发者ID:tleviathan,项目名称:Dragablz,代码行数:4,代码来源:TabablzControl.cs

示例15: SetHasMaximizeButton

 public static void SetHasMaximizeButton(Window element, bool value)
 {
     element.SetValue(ControlBox.HasMaximizeButtonProperty, value);
 }
开发者ID:super860327,项目名称:firstwpftest,代码行数:4,代码来源:ControlBox.cs


注:本文中的System.Windows.Window.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。