コード例 #1
0
ファイル: BubbleScrolling.cs プロジェクト: Nimgoble/Jibbr
        /// <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);
        }
コード例 #2
0
ファイル: SpellCheck.cs プロジェクト: mparsin/Elements
        /// <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);
        }
コード例 #3
0
ファイル: FontHandler.cs プロジェクト: modulexcite/Eto-1
 public static void Apply(swc.Control control, Font font)
 {
     if (control == null)
     {
         return;
     }
     if (font != null)
     {
         ((FontHandler)font.Handler).Apply(control);
     }
     else
     {
         control.SetValue(swc.Control.FontFamilyProperty, swc.Control.FontFamilyProperty.DefaultMetadata.DefaultValue);
         control.SetValue(swc.Control.FontStyleProperty, swc.Control.FontStyleProperty.DefaultMetadata.DefaultValue);
         control.SetValue(swc.Control.FontWeightProperty, swc.Control.FontWeightProperty.DefaultMetadata.DefaultValue);
         control.SetValue(swc.Control.FontSizeProperty, swc.Control.FontSizeProperty.DefaultMetadata.DefaultValue);
     }
 }
コード例 #4
0
ファイル: Conversions.cs プロジェクト: CheckTech/Eto
 public static Font SetEtoFont(this swc.Control control, Font font, Action <sw.TextDecorationCollection> setDecorations = null)
 {
     if (control == null)
     {
         return(font);
     }
     if (font != null)
     {
         ((FontHandler)font.Handler).Apply(control, setDecorations);
     }
     else
     {
         control.SetValue(swc.Control.FontFamilyProperty, swc.Control.FontFamilyProperty.DefaultMetadata.DefaultValue);
         control.SetValue(swc.Control.FontStyleProperty, swc.Control.FontStyleProperty.DefaultMetadata.DefaultValue);
         control.SetValue(swc.Control.FontWeightProperty, swc.Control.FontWeightProperty.DefaultMetadata.DefaultValue);
         control.SetValue(swc.Control.FontSizeProperty, swc.Control.FontSizeProperty.DefaultMetadata.DefaultValue);
     }
     return(font);
 }
コード例 #5
0
ファイル: DoubleClick.cs プロジェクト: changhongfu/TDDKata
        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;
        }
コード例 #6
0
 public static void SetParameter(Control target, object value)
 {
     target.SetValue(ParameterProperty, value);
 }
コード例 #7
0
ファイル: Watermark.cs プロジェクト: ZhuXiaomin/Hourglass
 /// <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);
 }
コード例 #8
0
ファイル: DoubleClick.cs プロジェクト: changhongfu/TDDKata
 public static void SetCommandParameter(Control control, object parameter)
 {
     control.SetValue(CommandParameterProperty, parameter);
 }
コード例 #9
0
 public static void SetTarget(Control element, UIElement value)
 {
     element.SetValue(TargetProperty, value);
 }
コード例 #10
0
 public static void SetEnabledOpacity(Control element, EnabledOpacity value) { element.SetValue(EnabledOpacityProperty, value); }
コード例 #11
0
 public static void SetIsControlSizeBound(Control element, bool Value)
 {
     element.SetValue(IsControlSizeBoundProperty, Value);
 }
コード例 #12
0
 public static void SetOneWayControlWidth(Control element, double Value)
 {
     element.SetValue(OneWayControlWidthProperty, Value);
 }
コード例 #13
0
ファイル: FrameworkElementTest.cs プロジェクト: dfr0/moon
		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");
				}
			);
		}
コード例 #14
0
ファイル: ModelingDesigner.cs プロジェクト: 569550384/Rafy
 public static void SetComponent(Control element, IModelingDesignerComponent value)
 {
     element.SetValue(ComponentPropertyKey, value);
 }
コード例 #15
0
		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;
		}
コード例 #16
0
 public static void SetCommand(Control target, ICommand value)
 {
     target.SetValue(CommandProperty, value);
 }
コード例 #17
0
ファイル: ScrollExtension.cs プロジェクト: mparsin/Elements
        /// <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);
        }
コード例 #18
0
 public static void SetDoubleClickCommandParameter(Control element, ICommand value)
 {
     element.SetValue(DoubleClickCommandParameterProperty, value);
 }
コード例 #19
0
ファイル: Placeholder.cs プロジェクト: hectorcayul/Magnolia-
        public static void SetText(Control adornedElement, string placeholderText)
        {
            if (adornedElement == null)
                throw new ArgumentNullException("adornedElement");

            if (!(adornedElement is TextBox || adornedElement is RichTextBox || adornedElement is PasswordBox))
                throw new InvalidOperationException();
            adornedElement.SetValue(TextProperty, placeholderText);
        }
コード例 #20
0
ファイル: FrameworkElementTest.cs プロジェクト: dfr0/moon
		void LogicalInheritanceCore (Control c1, DependencyProperty prop1, FrameworkElement c2, DependencyProperty prop2, object value, object other)
		{
			// Check that we inherit values even if the visual tree doesn't exist,
			// i.e. if we use logical inheritance.
			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.AreEqual (c1.GetValue (prop1), c2.GetValue (prop2), "#5");

			// Now generate a visual tree with 'c2' at the end and check that the visual
			// tree doesn't affect which value is inherited
			CreateAsyncTest (c1,
				() => {
					c1.ApplyTemplate ();
				}, () => {
					var visualParent = (FrameworkElement) VisualTreeHelper.GetChild (c1, 0);
					visualParent.SetValue (prop1, other);
					Assert.AreEqual (c2.GetValue (prop2), value, "#6");
				}
			);
		}
コード例 #21
0
 public static void SetOpenShellContextMenu(Control control, bool value)
 {
     control.SetValue(OpenShellContextMenuProperty, value);
 }
コード例 #22
0
 public static void SetShiftWheelScrollsHorizontally(Control element, bool value)
 => element.SetValue(ShiftWheelScrollsHorizontallyProperty, value);
コード例 #23
0
 public static void SetInterceptKeySelectionEvents(Control element, bool value)
 {
     element.SetValue(InterceptKeySelectionEventsProperty, value);
 }
コード例 #24
0
 public static void SetFocusOnFirstElement(Control control, bool value)
 {
     control.SetValue(FocusOnFirstElementProperty, value);
 }
コード例 #25
0
ファイル: VSM.cs プロジェクト: thnk2wn/codestock-winphone
 public static void SetStateName(Control o, string value)
 {
     o.SetValue(StateNameProperty, value);
 }
コード例 #26
0
 public static void SetOneWayControlHeight(Control element, double Value)
 {
     element.SetValue(OneWayControlHeightProperty, Value);
 }
コード例 #27
0
ファイル: FocusBehavior.cs プロジェクト: Mikescher/Passpad
 public static void SetWPFFocusFirst(Control control, bool value)
 {
     control.SetValue(WPFFocusFirstProperty, value);
 }
コード例 #28
0
ファイル: SpellCheck.cs プロジェクト: mparsin/Elements
 private static void SetOperationId(Control control, Guid value)
 {
     control.SetValue(OperationIdProperty, value);
 }
コード例 #29
0
ファイル: Commander.cs プロジェクト: brentedwards/Movies
 /// <summary>
 /// Sets the value for the EventName attached property on the provided <see cref="Control"/>.
 /// </summary>
 /// <param name="control">DependencyObject to attach the EventName to.</param>
 /// <param name="eventName">The name of the event to attach.</param>
 public static void SetEventName(Control control, String eventName)
 {
     control.SetValue(EventNameProperty, eventName);
 }
コード例 #30
0
ファイル: Commander.cs プロジェクト: brentedwards/Movies
        private static CommandBehaviorBase<Control> GetOrCreateBehavior(Control control)
        {
            var behavior = control.GetValue(EventCommandBehaviorProperty) as CommandBehaviorBase<Control>;

            if (behavior == null)
            {
                behavior = CreateCommandBehavior(control, control.GetValue(EventNameProperty).ToString());
                control.SetValue(EventCommandBehaviorProperty, behavior);
            }

            return behavior;
        }
コード例 #31
0
ファイル: DoubleClick.cs プロジェクト: changhongfu/TDDKata
 public static void SetCommand(Control control, ICommand command)
 {
     control.SetValue(CommandProperty, command);
 }
コード例 #32
0
ファイル: Interaction.cs プロジェクト: nikhilk/silverlightfx
 /// <summary>
 /// Sets the current visual state of the specified control.
 /// </summary>
 /// <param name="control">The control to set.</param>
 /// <param name="state">The name of the state that the control should be in.</param>
 public static void SetVisualState(Control control, string state)
 {
     control.SetValue(VisualStateProperty, state);
 }
コード例 #33
0
ファイル: Watermark.cs プロジェクト: Dziemborowicz/Hourglass
 /// <summary>
 /// Sets the value of the <see cref="HintBrushProperty"/>.
 /// </summary>
 /// <param name="control">A <see cref="Control"/>.</param>
 /// <param name="value">The value to set.</param>
 public static void SetHintBrush(Control control, Brush value)
 {
     control.SetValue(HintBrushProperty, value);
 }