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


C# Control.SetValue方法代码示例

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


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

示例1: SetIsSendingMouseWheelEventToParent

        /// <summary>
        /// Sets the IsSendingMouseWheelEventToParent for a given <see cref="TextBox"/>.
        /// </summary>
        /// <param name="control">
        /// The <see cref="TextBox"/> whose IsSendingMouseWheelEventToParent is to be set.
        /// </param>
        /// <param name="IsSendingMouseWheelEventToParent">
        /// The IsSendingMouseWheelEventToParent to set, or <see langword="null"/>
        /// to remove any existing IsSendingMouseWheelEventToParent from <paramref name="control"/>.
        /// </param>
        public static void SetIsSendingMouseWheelEventToParent(Control control, bool? sendToParent)
        {
            if (control == null)
                throw new ArgumentNullException("");

            control.SetValue(ScrollProperty, sendToParent);
        }
开发者ID:Nimgoble,项目名称:Jibbr,代码行数:17,代码来源:BubbleScrolling.cs

示例2: SetCulture

        /// <summary>
        /// Sets the spell checking culture of the specified control.
        /// </summary>
        /// <param name="control">
        /// The control.
        /// </param>
        /// <param name="value">
        /// The spell checking culture.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="value"/> parameter is null.
        /// </exception>
        public static void SetCulture(Control control, CultureInfo value)
        {
            if (control == null)
                throw new ArgumentNullException("control");

            control.SetValue(CultureProperty, value);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:19,代码来源:SpellCheck.cs

示例3: GetOrCreateBehavior

        private static DoubleClickCommandBehavior GetOrCreateBehavior(Control control)
        {
            var behavior = control.GetValue(DoubleClickCommandBehaviorProperty) as DoubleClickCommandBehavior;
            if (behavior == null)
            {
                behavior = new DoubleClickCommandBehavior(control);
                control.SetValue(DoubleClickCommandBehaviorProperty, behavior);
            }

            return behavior;
        }
开发者ID:changhongfu,项目名称:TDDKata,代码行数:11,代码来源:DoubleClick.cs

示例4: SetCommandParameter

 public static void SetCommandParameter(Control control, object parameter)
 {
     control.SetValue(CommandParameterProperty, parameter);
 }
开发者ID:changhongfu,项目名称:TDDKata,代码行数:4,代码来源:DoubleClick.cs

示例5: SetOpenShellContextMenu

 public static void SetOpenShellContextMenu(Control control, bool value)
 {
     control.SetValue(OpenShellContextMenuProperty, value);
 }
开发者ID:notsonormal,项目名称:AstoundingDock,代码行数:4,代码来源:ShellContextMenuBehaviour.cs

示例6: SetEnabledOpacity

 public static void SetEnabledOpacity(Control element, EnabledOpacity value) { element.SetValue(EnabledOpacityProperty, value); }
开发者ID:philcockfield,项目名称:Open.TestHarness.SL,代码行数:1,代码来源:Behaviors.cs

示例7: SetHint

 /// <summary>
 /// Sets the value of the <see cref="HintProperty"/>.
 /// </summary>
 /// <param name="control">A <see cref="Control"/>.</param>
 /// <param name="value">The value to set.</param>
 public static void SetHint(Control control, object value)
 {
     control.SetValue(HintProperty, value);
 }
开发者ID:ZhuXiaomin,项目名称:Hourglass,代码行数:9,代码来源:Watermark.cs

示例8: SetOneWayControlHeight

 public static void SetOneWayControlHeight(Control element, double Value)
 {
     element.SetValue(OneWayControlHeightProperty, Value);
 }
开发者ID:ptownsend1984,项目名称:SampleApplications,代码行数:4,代码来源:ControlExtensions.cs

示例9: SetOperationId

 private static void SetOperationId(Control control, Guid value)
 {
     control.SetValue(OperationIdProperty, value);
 }
开发者ID:mparsin,项目名称:Elements,代码行数:4,代码来源:SpellCheck.cs

示例10: VisualInheritanceCore

		void VisualInheritanceCore (Control c1, DependencyProperty prop1, FrameworkElement c2, DependencyProperty prop2, object value, object other)
		{
			Assert.AreSame (c1, c2.Parent, "#parented");
			Assert.AreNotEqual (value, c1.GetValue (prop1), "#1");
			Assert.AreNotEqual (value, c2.GetValue (prop2), "#2");
			Assert.IsNull (VisualTreeHelper.GetParent (c2), "#c2 no parent");
			Assert.AreEqual (0, VisualTreeHelper.GetChildrenCount (c1), "#c1 no children");

			c1.SetValue (prop1, value);
			Assert.IsNotNull (c1.GetValue (prop1), "#3");
			Assert.IsNotNull (c2.GetValue (prop2), "#4");
			Assert.AreNotEqual (c1.GetValue (prop1), c2.GetValue (prop2), "#5");

			// Once we connect c2 to c1 via the template visual tree, it will inherit the value
			CreateAsyncTest (c1,
				() => {
					c1.ApplyTemplate ();
				}, () => {
					Assert.AreEqual (c1.GetValue (prop1), c2.GetValue (prop2), "#6");

					// And if we change the value inside the template, it affects c2
					var visualParent = (FrameworkElement) VisualTreeHelper.GetChild (c1, 0);
					visualParent.SetValue (prop1, other);
					Assert.AreEqual (c2.GetValue (prop2), other, "#7");
				}
			);
		}
开发者ID:dfr0,项目名称:moon,代码行数:27,代码来源:FrameworkElementTest.cs

示例11: SetFocusOnFirstElement

 public static void SetFocusOnFirstElement(Control control, bool value)
 {
     control.SetValue(FocusOnFirstElementProperty, value);
 }
开发者ID:debbievermaak,项目名称:azure-scaffolder,代码行数:4,代码来源:FocusBehavior.cs

示例12: SetParameter

 public static void SetParameter(Control target, object value)
 {
     target.SetValue(ParameterProperty, value);
 }
开发者ID:eatplayhate,项目名称:versionr,代码行数:4,代码来源:ControlDoubleClick.cs

示例13: EnsureInstance

		private static AutoComplete EnsureInstance( Control ctrl )
		{
			var ac = ( AutoComplete )ctrl.GetValue( AutoComplete.AutoCompleteInstance );
			if( ac == null )
			{
				ac = new AutoComplete( ctrl );
				//ac.SetControl( ctrl );
				ctrl.SetValue( AutoCompleteInstancePropertyKey, ac );
			}

			return ac;
		}
开发者ID:micdenny,项目名称:Radical.Windows,代码行数:12,代码来源:AutoComplete.cs

示例14: SetCommand

 public static void SetCommand(Control target, ICommand value)
 {
     target.SetValue(CommandProperty, value);
 }
开发者ID:eatplayhate,项目名称:versionr,代码行数:4,代码来源:ControlDoubleClick.cs

示例15: SetFocusOnLoaded

        /// <summary>
        /// Sets a value indicating whether the control should receive focus on Loaded event.
        /// </summary>
        /// <param name="control">
        /// The control.
        /// </param>
        /// <param name="value">
        /// <c>true</c> if the control should receive focus on Loaded event; otherwise, <c>false</c>.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="control"/> parameter is null.
        /// </exception>
        public static void SetFocusOnLoaded(Control control, bool value)
        {
            if (control == null)
                throw new ArgumentNullException("control");

            control.SetValue(FocusOnLoadedProperty, value);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:19,代码来源:ScrollExtension.cs


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