System.Windows.DependencyObject.SetValue(System.Windows.DependencyPropertyKey, object)

Here are the examples of the csharp api System.Windows.DependencyObject.SetValue(System.Windows.DependencyPropertyKey, object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

669 Examples 7

19 View Source File : CodeHighlighter.cs
License : MIT License
Project Creator : ABTSoftware

public static void SetSourceLanguage(DependencyObject o, SourceLanguageType lang)
        {
            o.SetValue(SourceLanguageProperty, lang);
        }

19 View Source File : CoverFlowControl.cs
License : MIT License
Project Creator : ABTSoftware

private void IndexSelected(int index, bool mouseClick, bool layoutChildren)
        {
            if (_items.Count > 0)
            {
                _selectedIndex = index;
                _isZIndexAscending = _prevSelectedIndex <= _selectedIndex;
                _prevSelectedIndex = _selectedIndex;

                var item = _items.Count > 0 ? _items[SelectedIndex].Content : null;

                SetValue(SelectedItemProperty, item);

                if (layoutChildren)
                    InvalidateArrange();

                var args = new CoverFlowEventArgs
                {
                    Index = index,
                    Item = _items[index].Content,
                    MouseClick = mouseClick
                };

                SelectedItemChanged?.Invoke(args);

                if (PropertyChanged != null)
                    OnPropertyChanged("SelectedIndex");
            }
        }

19 View Source File : SwitchAxisTypeBehavior.cs
License : MIT License
Project Creator : ABTSoftware

public static void SetDefaultXAxis(DependencyObject element, AxisBase value)
        {
            element.SetValue(DefaultXAxisProperty, value);
        }

19 View Source File : SwitchAxisTypeBehavior.cs
License : MIT License
Project Creator : ABTSoftware

public static void SetAlternativeXAxis(DependencyObject element, AxisBase value)
        {
            element.SetValue(AlternativeXAxisProperty, value);
        }

19 View Source File : SwitchAxisTypeBehavior.cs
License : MIT License
Project Creator : ABTSoftware

public static void SetDefaultYAxis(DependencyObject element, AxisBase value)
        {
            element.SetValue(DefaultYAxisProperty, value);
        }

19 View Source File : SwitchAxisTypeBehavior.cs
License : MIT License
Project Creator : ABTSoftware

public static void SetAlternativeYAxis(DependencyObject element, AxisBase value)
        {
            element.SetValue(AlternativeYAxisProperty, value);
        }

19 View Source File : FocusBehavior.cs
License : MIT License
Project Creator : Actipro

private static void UpdateFocusedHeader(DataGridControl datagrid) {
			if (null == datagrid)
				return;

			// Get the list of headers
			IList<DependencyObject> headers = VisualTreeHelperExtended.GetAllDescendants(datagrid, typeof(DataGridColumnHeader));
			if (null == headers || 0 == headers.Count)
				return;

			// Update the focus based on the current tracking Modes
			FocusTrackingModes trackingModes = GetTrackingModes(datagrid);
			if (0 != (trackingModes & FocusTrackingModes.Headers)) {

				// Get the focused cell, if any, and look for an ancestor cell when editing cell
				DataGridCell cell = Keyboard.FocusedElement as DataGridCell;
				if (cell == null)
					cell = VisualTreeHelperExtended.GetAncestor(Keyboard.FocusedElement as FrameworkElement, typeof(DataGridCell)) as DataGridCell;

				// Update header focus, if any
				foreach (DataGridColumnHeader header in headers) {

					// Determine if the column replacedociated with this header if focused
					bool isFocused = (null != cell && cell.Column == header.Column);

					// Update the focus for this header
					if (isFocused != GetIsFocusedHeader(header)) {
						if (isFocused)
							header.SetValue(IsFocusedHeaderPropertyKey, true);
						else
							header.ClearValue(IsFocusedHeaderPropertyKey);
					}
				}
			}
			else {
				// Clear header focus, if any
				foreach (DataGridColumnHeader header in headers) {
					if (GetIsFocusedHeader(header))
						header.ClearValue(IsFocusedHeaderPropertyKey);
				}
			}
		}

19 View Source File : FocusBehavior.cs
License : MIT License
Project Creator : Actipro

[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPreplacedingBaseTypesAsParameters")]
		public static void SetTrackingModes(DataGridControl obj, FocusTrackingModes value) {
			if (null == obj) throw new ArgumentNullException("obj");
			obj.SetValue(FocusBehavior.TrackingModesProperty, value);
		}

19 View Source File : SelectionBehavior.cs
License : MIT License
Project Creator : Actipro

[SuppressMessage("Microsoft.Design", "CA1011:ConsiderPreplacedingBaseTypesAsParameters")]
		public static void SetTrackingModes(DataGridControl obj, SelectionTrackingModes value) {
			if (null == obj) throw new ArgumentNullException("obj");
			obj.SetValue(SelectionBehavior.TrackingModesProperty, value);
		}

19 View Source File : NewRowTemplateBehavior.cs
License : MIT License
Project Creator : Actipro

private static void SetDefaultTemplate(DataGridControl obj, ControlTemplate value) {
			if (null == obj) throw new ArgumentNullException("obj");
			obj.SetValue(NewRowTemplateBehavior.DefaultTemplatePropertyKey, value);
		}

19 View Source File : SelectionBehavior.cs
License : MIT License
Project Creator : Actipro

private static void UpdateSelectedHeaders(DataGridControl datagrid) {
			if (null == datagrid)
				return;

			// Get the list of headers
			IList<DependencyObject> headers = VisualTreeHelperExtended.GetAllDescendants(datagrid, typeof(DataGridColumnHeader));
			if (null == headers || 0 == headers.Count)
				return;

			// Update the selection based on the current tracking modes
			SelectionTrackingModes trackingModes = GetTrackingModes(datagrid);
			if (0 != (trackingModes & SelectionTrackingModes.Headers)) {
				
				// Update header selections, if any
				foreach (DataGridColumnHeader header in headers) {

					// Determine if the column replacedociated with this header has any selected cells
					bool isSelected = false;
					foreach (DataGridCellInfo cellInfo in datagrid.SelectedCells) {
						if (cellInfo.Column == header.Column) {
							isSelected = true;
							break;
						}
					}

					// Update the selection for this header
					if (isSelected != GetIsSelectedHeader(header)) {
						if (isSelected)
							header.SetValue(IsSelectedHeaderPropertyKey, true);
						else
							header.ClearValue(IsSelectedHeaderPropertyKey);
					}
				}
			}
			else {
				// Clear header selections, if any
				foreach (DataGridColumnHeader header in headers) {
					if (GetIsSelectedHeader(header))
						header.ClearValue(IsSelectedHeaderPropertyKey);
				}
			}
		}

19 View Source File : RichTextboxAssistant.cs
License : GNU Affero General Public License v3.0
Project Creator : akshinmustafayev

public static void SetBoundDoreplacedent(DependencyObject dependencyObject, string value)
        {
			if (dependencyObject != null)
			{
				var xaml = value;
				var html = HtmlFromXamlConverter.ConvertXamlToHtml(xaml, false);
				dependencyObject.SetValue(BoundDoreplacedent, html);
			}
        }

19 View Source File : ImageContentHelper.cs
License : MIT License
Project Creator : Aleksbgbg

internal static void SetImage(DependencyObject dependencyObject, ImageSource value)
        {
            dependencyObject.SetValue(ImageProperty, value);
        }

19 View Source File : ImageContentHelper.cs
License : MIT License
Project Creator : Aleksbgbg

internal static void SetContent(DependencyObject dependencyObject, string value)
        {
            dependencyObject.SetValue(ContentProperty, value);
        }

19 View Source File : SelectedItemsHelper.cs
License : MIT License
Project Creator : Aleksbgbg

internal static void SetSelectedItems(DependencyObject dependencyObject, IList value)
        {
            dependencyObject.SetValue(SelectedItemsProperty, value);
        }

19 View Source File : ListBoxWithPosition.cs
License : GNU General Public License v3.0
Project Creator : alexdillon

private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e)
        {
            // When DPI scaling is enabled, pixel values may be floating point. Round down to integers to
            // prevent floating-point roundoff error when comparing values.
            var atBottom = (int)e.VerticalOffset == (int)(e.OriginalSource as ScrollViewer).ScrollableHeight;
            this.SetValue(IsNotAtBottomPropertyKey, !atBottom);

            if (this.ShouldSnapToBottom)
            {
                if (atBottom)
                {
                    this.ShouldSnapToBottom = false;
                }
                else
                {
                    this.ScrollViewer.ScrollToBottom();
                }
            }
        }

19 View Source File : Event.cs
License : GNU General Public License v3.0
Project Creator : AndreiFedarets

private static ControlEventCommandBehavior GetOrCreateBehavior(Control control)
        {
            string eventName = GetEventName(control);
            if (string.IsNullOrEmpty(eventName) || !Behaviors.ContainsKey(eventName))
            {
                eventName = ClickEventName;
            }
            ControlEventCommandBehavior behavior =
                (ControlEventCommandBehavior) control.GetValue(EventCommandBehaviorProperty);
            if (behavior == null)
            {
                Type behaviorType = Behaviors[eventName];
                behavior = (ControlEventCommandBehavior) Activator.CreateInstance(behaviorType, control);
                control.SetValue(EventCommandBehaviorProperty, behavior);
            }
            return behavior;
        }

19 View Source File : CustomWindowManager.cs
License : GNU General Public License v3.0
Project Creator : AndreiFedarets

protected override Window EnsureWindow(object model, object view, bool isDialog)
        {
            Window window = view as Window;
            if (window == null)
            {
                window = InstanceWindow();
                window.Content = view;
                window.SizeToContent = SizeToContent.Manual;
                window.SetValue(Caliburn.Micro.View.IsGeneratedProperty, true);
                CloneSize(window, view);
                Window window2 = InferOwnerOf(window);
                if (window2 != null)
                {
                    window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                    window.Owner = window2;
                }
                else
                {
                    window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                }
            }
            else
            {
                Window window3 = InferOwnerOf(window);
                if (window3 != null && isDialog)
                {
                    window.Owner = window3;
                }
            }
            return window;
        }

19 View Source File : TaskbarIconBehaviors.cs
License : GNU General Public License v3.0
Project Creator : Angelinsky7

public static void SetIcon(DependencyObject target, Icon value) {
            target.SetValue(IconProperty, value);
        }

19 View Source File : TileControl.xaml.cs
License : Apache License 2.0
Project Creator : anmcgrath

public static void SetTopLeft(UIElement element, TilerControlItem value)
        {
            element.SetValue(TopLeftProperty, value);
        }

19 View Source File : TileControl.xaml.cs
License : Apache License 2.0
Project Creator : anmcgrath

public static void SetTopRight(UIElement element, TilerControlItem value)
        {
            element.SetValue(TopRightProperty, value);
        }

19 View Source File : TileControl.xaml.cs
License : Apache License 2.0
Project Creator : anmcgrath

public static void SetBottomRight(UIElement element, TilerControlItem value)
        {
            element.SetValue(BottomRightProperty, value);
        }

19 View Source File : TileControl.xaml.cs
License : Apache License 2.0
Project Creator : anmcgrath

public static void SetBottomLeft(UIElement element, TilerControlItem value)
        {
            element.SetValue(BottomLeftProperty, value);
        }

19 View Source File : MagnifierManager.cs
License : MIT License
Project Creator : AntonyCorbett

public static void SetMagnifier(UIElement element, Magnifier value) => element.SetValue(CurrentProperty, value);

19 View Source File : DelcamNavigation.cs
License : MIT License
Project Creator : Autodesk

protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            base.OnSelectionChanged(e);

            foreach (DelcamNavigationButton objHeader in Items)
            {
                if (ReferenceEquals(objHeader, SelectedItem))
                {
                    if (objHeader.NavigationContent != null)
                    {
                        // Force a refresh of the content
                        ClearValue(SelectedContentProperty);
                        SetValue(SelectedContentProperty, objHeader.NavigationContent);
                        if (objHeader.NavigationContent != null && objHeader.NavigationContent is UIElement)
                        {
                            ((UIElement) objHeader.NavigationContent).InvalidateVisual();
                        }
                    }
                    objHeader.IsExpanded = true;
                }
                else
                {
                    objHeader.IsExpanded = false;
                }
            }
        }

19 View Source File : DelcamDesktop.cs
License : MIT License
Project Creator : Autodesk

protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            base.OnSelectionChanged(e);

            foreach (DelcamDesktopPage objPage in Items)
            {
                if (ReferenceEquals(objPage, SelectedItem))
                {
                    // Force a refresh of the header
                    ClearValue(SelectedHeaderProperty);
                    SetValue(SelectedHeaderProperty, objPage.Header);
                    if (objPage.Header != null && ReferenceEquals(objPage.Header.GetType(), typeof(UIElement)))
                    {
                        ((UIElement) objPage.Header).InvalidateVisual();
                    }

                    // Force a refresh of the content
                    ClearValue(SelectedContentProperty);
                    SetValue(SelectedContentProperty, objPage.Content);
                    if (objPage.Content != null && objPage.Content is UIElement)
                    {
                        ((UIElement) objPage.Content).InvalidateVisual();
                    }
                    objPage.IsSelected = true;
                }
                else
                {
                    objPage.IsExpanded = false;
                    objPage.IsSelected = false;
                }
            }
        }

19 View Source File : DelcamTextBox.cs
License : MIT License
Project Creator : Autodesk

public static void TextPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            DelcamTextBox target = (DelcamTextBox) sender;

            bool isEmpty = target.Text.Length == 0;
            if (isEmpty != target.IsEmpty)
            {
                target.SetValue(IsEmptyPropertyKey, isEmpty);
            }
        }

19 View Source File : AySplitViewService.cs
License : MIT License
Project Creator : ay2015

public static void SetToggleMenu(DependencyObject obj, AySplitView value)
        {
            obj.SetValue(ToggleMenuProperty, value);
        }

19 View Source File : AyWindowBase.cs
License : MIT License
Project Creator : ay2015

public static void SetSetElementMove(DependencyObject obj, ElementMoveMode value)
        {
            obj.SetValue(SetElementMoveProperty, value);
        }

19 View Source File : Selector.cs
License : MIT License
Project Creator : ay2015

protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
		{
			base.PrepareContainerForItemOverride(element, item);
			_surpressItemSelectionChanged = true;
			FrameworkElement frameworkElement = element as FrameworkElement;
			frameworkElement.SetValue(SelectorItem.IsSelectedProperty, SelectedItems.Contains(item));
			_surpressItemSelectionChanged = false;
		}

19 View Source File : AyVisualStateManager.cs
License : MIT License
Project Creator : ay2015

private static void ExecuteSetters(AyVisualState item, FrameworkElement w)
        {
            Window _parentWindow = null;
            if (w is Window)
            {
                _parentWindow = w as Window;
            }
            else
            {
                _parentWindow = Window.GetWindow(w);
            }
            UserControl _parentUserControl = null;
            if (w is UserControl)
            {
                _parentUserControl = w as UserControl;
            }
            else
            {
                _parentUserControl = WpfTreeHelper.FindParentControl<UserControl>(w);
            }

            Page _parentPage = null;
            if (w is Page)
            {
                _parentPage = w as Page;
            }
            else
            {
                _parentPage = WpfTreeHelper.FindParentControl<Page>(w);
            }

            foreach (var setter2 in item.Setters)
            {
                if (setter2 is DataSetter)
                {
                    var setter = setter2 as DataSetter;

                    if (setter.TargetName!=null)
                    {
                        switch (setter.Scope)
                        {
                            case DataSetterScope.Current:
                                var _CurrentFind = w.FindName(setter.TargetName) as UIElement;
                                if (_CurrentFind!=null)
                                {
                                    _CurrentFind.SetValue(setter.Property, setter.Value);
                                }
                                break;
                            case DataSetterScope.ParentWindow:
                                if (_parentWindow!=null)
                                {
                                    var _ParentWindowFind = _parentWindow.FindName(setter.TargetName) as UIElement;
                                    if (_ParentWindowFind!=null)
                                    {
                                        _ParentWindowFind.SetValue(setter.Property, setter.Value);
                                    }
                                }
                                break;
                            case DataSetterScope.ParentPage:
                                if (_parentPage!=null)
                                {
                                    var _ParentPageFind = _parentPage.FindName(setter.TargetName) as UIElement;
                                    if (_ParentPageFind!=null)
                                    {
                                        _ParentPageFind.SetValue(setter.Property, setter.Value);
                                    }
                                }
                                break;
                        }
                    }
                }
                else if (setter2 is ResourceSetter)
                {
                    var setter = setter2 as ResourceSetter;

                    if (setter.TargetName!=null)
                    {
                        switch (setter.Scope)
                        {
                            case ResourceSetterScope.FindInPageResource:
                                if (_parentPage!=null)
                                {
                                    var _resources = _parentPage.Resources;
                                    _resources[setter.TargetName] = Convert.ChangeType(setter.ResourceValue, setter.ResourceType);
                                }
                                break;
                            case ResourceSetterScope.FindInApplicationResource:
                                if (_parentPage!=null)
                                {
                                    var _resources = Application.Current.Resources;
                                    _resources[setter.TargetName] = Convert.ChangeType(setter.ResourceValue, setter.ResourceType);
                                }
                                break;
                            case ResourceSetterScope.FindInWindowResource:
                                if (_parentPage!=null)
                                {
                                    var _resources = _parentWindow.Resources;
                                    _resources[setter.TargetName] = Convert.ChangeType(setter.ResourceValue, setter.ResourceType);
                                }
                                break;
                            case ResourceSetterScope.FindInUserControlResource:
                                if (_parentPage!=null)
                                {
                                    var _resources = _parentUserControl.Resources;
                                    _resources[setter.TargetName] = Convert.ChangeType(setter.ResourceValue, setter.ResourceType);
                                }
                                break;
                        }
                    }

                }


            }
        }

19 View Source File : AyVisualStateManager.cs
License : MIT License
Project Creator : ay2015

[AttachedPropertyBrowsableForType(typeof(AyVisualStateGroup))]
        private static void SetAyVisualStateGroups(DependencyObject d, AyVisualStateGroupCollection value)
        {
            d.SetValue(AyVisualStateGroupsPropertyKey, value);
            INotifyCollectionChanged collection = (INotifyCollectionChanged)value;
            collection.CollectionChanged += new NotifyCollectionChangedEventHandler(CollectionChanged);
        }

19 View Source File : ImageBehavior.cs
License : MIT License
Project Creator : ay2015

private static void SetAnimationController(DependencyObject obj, ImageAnimationController value)
        {
            obj.SetValue(AnimationControllerPropertyKey, value);
        }

19 View Source File : ImageBehavior.cs
License : MIT License
Project Creator : ay2015

private static void SetIsAnimationLoaded(Image image, bool value)
        {
            image.SetValue(IsAnimationLoadedPropertyKey, value);
        }

19 View Source File : ColorPicker.xaml.cs
License : MIT License
Project Creator : ay2015

private void superCombo_DropDownClosed(object sender, EventArgs e)
        {
            this.SetValue(SelectedColorProperty, this.viewModel.SelectedFontColor);
            this.RaiseColorChangedEvent();
        }

19 View Source File : ColorPicker.xaml.cs
License : MIT License
Project Creator : ay2015

private void superCombo_Loaded(object sender, RoutedEventArgs e)
        {
            this.SetValue(SelectedColorProperty, this.viewModel.SelectedFontColor);
        }

19 View Source File : Mvc.cs
License : MIT License
Project Creator : ay2015

public static void SetAction(DependencyObject d, ActionResult value)
        {
            d.SetValue(ActionProperty, value);
        }

19 View Source File : MvcRouteCollection.cs
License : MIT License
Project Creator : ay2015

private static void SetRoutes(DependencyObject d, BehaviorBindingCollection value)
        {
            d.SetValue(RoutesPropertyKey, value);
            INotifyCollectionChanged collection = (INotifyCollectionChanged)value;
            collection.CollectionChanged += new NotifyCollectionChangedEventHandler(CollectionChanged);
        }

19 View Source File : Mvc.cs
License : MIT License
Project Creator : ay2015

private static void SetBehavior(DependencyObject d, CommandBehaviorBinding value)
        {
            d.SetValue(BehaviorProperty, value);
        }

19 View Source File : UIHelper.cs
License : MIT License
Project Creator : Azure-Samples

public static void SetPreplacedMouseWheelToParent(UIElement obj, bool value)
        {
            obj.SetValue(PreplacedMouseWheelToParentProperty, value);
            if (value)
            {
                obj.PreviewMouseWheel += Obj_PreviewMouseWheel;
            }
            else
            {
                obj.PreviewMouseWheel -= Obj_PreviewMouseWheel;
            }
        }

19 View Source File : BaseMetroDialog.cs
License : Apache License 2.0
Project Creator : beckzhu

internal void HandleThemeChange()
        {
            var windowTheme = DetectTheme(this);

            if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this) || windowTheme == null)
            {
                return;
            }

            Accent windowAccent = windowTheme.Item2;
            AppTheme theme = windowTheme.Item1;

            if (this.DialogSettings != null)
            {
                switch (this.DialogSettings.ColorScheme)
                {
                    case MetroDialogColorScheme.Theme:
                        ThemeManager.ChangeAppStyle(this.Resources, windowAccent, theme);
                        this.SetValue(BackgroundProperty, TryGetResource(windowAccent, theme, "WhiteColorBrush"));
                        this.SetValue(ForegroundProperty, TryGetResource(windowAccent, theme, "BlackBrush"));
                        break;
                    case MetroDialogColorScheme.Inverted:
                        theme = ThemeManager.GetInverseAppTheme(theme);
                        if (theme == null)
                        {
                            throw new InvalidOperationException("The inverse dialog theme only works if the window theme abides the naming convention. " +
                                                                "See ThemeManager.GetInverseAppTheme for more infos");
                        }

                        ThemeManager.ChangeAppStyle(this.Resources, windowAccent, theme);
                        this.SetValue(BackgroundProperty, TryGetResource(windowAccent, theme, "WhiteColorBrush"));
                        this.SetValue(ForegroundProperty, TryGetResource(windowAccent, theme, "BlackBrush"));
                        break;
                    case MetroDialogColorScheme.Accented:
                        ThemeManager.ChangeAppStyle(this.Resources, windowAccent, theme);
                        this.SetValue(BackgroundProperty, TryGetResource(windowAccent, theme, "HighlightBrush"));
                        this.SetValue(ForegroundProperty, TryGetResource(windowAccent, theme, "IdealForegroundColorBrush"));
                        break;
                }
            }

            if (this.ParentDialogWindow != null)
            {
                this.ParentDialogWindow.SetValue(BackgroundProperty, this.Background);
                var glowBrush = TryGetResource(windowAccent, theme, "AccentColorBrush");
                if (glowBrush != null)
                {
                    this.ParentDialogWindow.SetValue(MetroWindow.GlowBrushProperty, glowBrush);
                }
            }
        }

19 View Source File : SliderHelper.cs
License : Apache License 2.0
Project Creator : beckzhu

[Category(AppName.MahApps)]
        [AttachedPropertyBrowsableForType(typeof(Slider))]
        [AttachedPropertyBrowsableForType(typeof(RangeSlider))]
        public static void SetChangeValueBy(UIElement element, MouseWheelChange value)
        {
            element.SetValue(ChangeValueByProperty, value);
        }

19 View Source File : SliderHelper.cs
License : Apache License 2.0
Project Creator : beckzhu

[Category(AppName.MahApps)]
        [AttachedPropertyBrowsableForType(typeof(Slider))]
        [AttachedPropertyBrowsableForType(typeof(RangeSlider))]
        public static void SetEnableMouseWheel(UIElement element, MouseWheelState value)
        {
            element.SetValue(EnableMouseWheelProperty, value);
        }

19 View Source File : TextBoxHelper.cs
License : Apache License 2.0
Project Creator : beckzhu

public static void SetButtonsAlignment(DependencyObject obj, ButtonsAlignment value)
        {
            obj.SetValue(ButtonsAlignmentProperty, value);
        }

19 View Source File : DatePickerTextBoxBehavior.cs
License : Apache License 2.0
Project Creator : beckzhu

private void SetHasTextProperty()
        {
            this.replacedociatedObject.TemplatedParent?.SetValue(TextBoxHelper.HasTextProperty, this.replacedociatedObject.Text.Length > 0);
        }

19 View Source File : TabControlHelper.cs
License : Apache License 2.0
Project Creator : beckzhu

public static void SetTransition(DependencyObject obj, TransitionType value)
        {
            obj.SetValue(TransitionProperty, value);
        }

19 View Source File : MetroWindowHelpers.cs
License : Apache License 2.0
Project Creator : beckzhu

private static void ChangeAllWindowCommandsBrush(this MetroWindow window, Brush brush, Position position = Position.Top)
        {
            if (brush == null)
            {
                // set the theme to light by default
                window.InvokeActionOnWindowCommands(x => x.SetValue(WindowCommands.ThemeProperty, Theme.Light),
                                                    x => x.SetValue(WindowButtonCommands.ThemeProperty, Theme.Light), position);

                // clear the foreground property
                window.InvokeActionOnWindowCommands(x => x.ClearValue(Control.ForegroundProperty), null, position);
            }
            else
            {
                // calculate brush color lightness
                var color = ((SolidColorBrush)brush).Color;

                var r = color.R / 255.0f;
                var g = color.G / 255.0f;
                var b = color.B / 255.0f;

                var max = r;
                var min = r;

                if (g > max) max = g;
                if (b > max) max = b;

                if (g < min) min = g;
                if (b < min) min = b;

                var lightness = (max + min) / 2;

                // set the theme based on color lightness
                if (lightness > 0.1)
                {
                    window.InvokeActionOnWindowCommands(x => x.SetValue(WindowCommands.ThemeProperty, Theme.Light),
                                                        x => x.SetValue(WindowButtonCommands.ThemeProperty, Theme.Light), position);
                }
                else
                {
                    window.InvokeActionOnWindowCommands(x => x.SetValue(WindowCommands.ThemeProperty, Theme.Dark),
                                                        x => x.SetValue(WindowButtonCommands.ThemeProperty, Theme.Dark), position);
                }

                // set the foreground property
                window.InvokeActionOnWindowCommands(x => x.SetValue(Control.ForegroundProperty, brush), null, position);
            }
        }

19 View Source File : StylizedBehaviors.cs
License : Apache License 2.0
Project Creator : beckzhu

public static void SetBehaviors(DependencyObject uie, StylizedBehaviorCollection value)
        {
            uie.SetValue(BehaviorsProperty, value);
        }

19 View Source File : NumericUpDown.cs
License : Apache License 2.0
Project Creator : beckzhu

private void InternalSetText(double? newValue)
        {
            if (!newValue.HasValue)
            {
                _valueTextBox.Text = null;
                return;
            }

            _valueTextBox.Text = FormattedValue(newValue, StringFormat, SpecificCultureInfo);

            if ((bool)GetValue(TextBoxHelper.IsMonitoringProperty))
            {
                SetValue(TextBoxHelper.TextLengthProperty, _valueTextBox.Text.Length);
            }
        }

19 View Source File : WindowChromeBehavior.cs
License : Apache License 2.0
Project Creator : beckzhu

private void InitializeWindowChrome()
        {
            this.windowChrome = new WindowChrome();

            BindingOperations.SetBinding(this.windowChrome, WindowChrome.ResizeBorderThicknessProperty, new Binding { Path = new PropertyPath(ResizeBorderThicknessProperty), Source = this });
            BindingOperations.SetBinding(this.windowChrome, WindowChrome.GlreplacedFrameThicknessProperty, new Binding { Path = new PropertyPath(GlreplacedFrameThicknessProperty), Source = this });
            this.windowChrome.CaptionHeight = 0;
            this.windowChrome.CornerRadius = default(CornerRadius);
            this.windowChrome.UseAeroCaptionButtons = false;

            this.replacedociatedObject.SetValue(WindowChrome.WindowChromeProperty, this.windowChrome);
        }

See More Examples