public static void SetAutoShowToolTipWhenObscured(FrameworkElement element, bool value) { if (element == null) { throw new ArgumentNullException(nameof(element)); } element.SetValue(AutoShowToolTipWhenObscuredProperty, Boxes.Box(value)); }
public static void SetHasMinimizeButton(Window window, bool value) { if (window == null) { throw new ArgumentNullException(nameof(window)); } window.SetValue(HasMinimizeButtonProperty, Boxes.Box(value)); }
public static void SetIsCurrentLocation(FrameworkElement element, bool value) { Validate.IsNotNull(element, nameof(element)); var ancestor = element.FindAncestor <Popup>(); if (ancestor != null && !GetIsNavigationEnabled(ancestor)) { return; } element.SetValue(IsCurrentLocationProperty, Boxes.Box(value)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is TSource) && (value != null || typeof(TSource).IsValueType)) { throw new ArgumentException(); } if (!targetType.IsAssignableFrom(typeof(bool))) { throw new InvalidOperationException(); } return(Boxes.Box(Convert((TSource)value, parameter, culture))); }
private bool HandleIsOriginalChanged(PropertyChangedEventArgs e) { if (e.PropertyName == "IsOriginalFile") { TextDocument document = this.Document; if (document != null) { SetCurrentValue(IsModifiedProperty, Boxes.Box(!document.UndoStack.IsOriginalFile)); } return(true); } else { return(false); } }
internal void RaiseIsReadOnlyChanged(bool oldValue, bool newValue) { RaisePropertyChangedEvent(ValuePatternIdentifiers.IsReadOnlyProperty, Boxes.Box(oldValue), Boxes.Box(newValue)); }
public static void SetIsNavigationEnabled(Popup searchControlPopup, bool value) { Validate.IsNotNull(searchControlPopup, nameof(searchControlPopup)); searchControlPopup.SetValue(IsNavigationEnabledProperty, Boxes.Box(value)); }
public static void SetIsNavigable(FrameworkElement element, bool value) { Validate.IsNotNull(element, nameof(element)); element.SetValue(IsNavigableProperty, Boxes.Box(value)); }
public void AllBoxesTest() { // Boolean Assert.Same(Boxes.Box(true), Boxes.Box(true)); Assert.Same(Boxes.Box(false), Boxes.Box(false)); Assert.NotSame(Boxes.Box(true), Boxes.Box(false)); // Byte Assert.Same(Boxes.Box((byte)0), Boxes.Box((byte)0)); Assert.NotSame(Boxes.Box((byte)3), Boxes.Box((byte)3)); // SByte Assert.Same(Boxes.Box((sbyte)0), Boxes.Box((sbyte)0)); Assert.NotSame(Boxes.Box((sbyte)3), Boxes.Box((sbyte)3)); // Int16 Assert.Same(Boxes.Box((short)0), Boxes.Box((short)0)); Assert.NotSame(Boxes.Box((short)3), Boxes.Box((short)3)); // UInt16 Assert.Same(Boxes.Box((ushort)0), Boxes.Box((ushort)0)); Assert.NotSame(Boxes.Box((ushort)3), Boxes.Box((ushort)3)); // Int32 Assert.Same(Boxes.Box(0), Boxes.Box(0)); Assert.Same(Boxes.Box(1), Boxes.Box(1)); Assert.Same(Boxes.BoxedInt32Zero, Boxes.Box(0)); Assert.Same(Boxes.BoxedInt32One, Boxes.Box(1)); Assert.NotSame(Boxes.Box(3), Boxes.Box(3)); // UInt32 Assert.Same(Boxes.Box(0u), Boxes.Box(0u)); Assert.NotSame(Boxes.Box(3u), Boxes.Box(3u)); // Int64 Assert.Same(Boxes.Box(0L), Boxes.Box(0L)); Assert.NotSame(Boxes.Box(3L), Boxes.Box(3L)); // UInt64 Assert.Same(Boxes.Box(0UL), Boxes.Box(0UL)); Assert.NotSame(Boxes.Box(3UL), Boxes.Box(3UL)); // Single Assert.Same(Boxes.Box(0.0f), Boxes.Box(0.0f)); Assert.NotSame(Boxes.Box(0.0f), Boxes.Box(-0.0f)); Assert.NotSame(Boxes.Box(1.0f), Boxes.Box(1.0f)); // Double Assert.Same(Boxes.Box(0.0), Boxes.Box(0.0)); Assert.NotSame(Boxes.Box(0.0), Boxes.Box(-0.0)); Assert.NotSame(Boxes.Box(1.0), Boxes.Box(1.0)); // Decimal Assert.Same(Boxes.Box(decimal.Zero), Boxes.Box(0m)); Assert.NotSame(Boxes.Box(0m), Boxes.Box(decimal.Negate(0m))); decimal strangeDecimalZero = new decimal(0, 0, 0, false, 10); Assert.Equal(decimal.Zero, strangeDecimalZero); Assert.NotSame(Boxes.Box(decimal.Zero), Boxes.Box(strangeDecimalZero)); // Char Assert.Same(Boxes.Box('\0'), Boxes.Box('\0')); Assert.Same(Boxes.Box('*'), Boxes.Box('*')); Assert.Same(Boxes.Box('0'), Boxes.Box('0')); Assert.NotSame(Boxes.Box('\u1234'), Boxes.Box('\u1234')); // non ASCII }
public static void SetAcquireFocus(UIElement obj, bool value) { obj.SetValue(AcquireFocusProperty, Boxes.Box(value)); }
internal void RaiseIsSelectedChanged(object item, bool oldValue, bool newValue) { var itemAutomationPeer = GetItemAutomationPeer(item); itemAutomationPeer?.RaisePropertyChangedEvent(SelectionItemPatternIdentifiers.IsSelectedProperty, Boxes.Box(oldValue), Boxes.Box(newValue)); }