Ejemplo n.º 1
1
		public static void SetBinding ( 
			DependencyObject target, 
			DependencyProperty property,
			Binding binding ) {

			throw new NotImplementedException ( );
		}
 /// <summary>
 /// SizeProperty property changed handler.
 /// </summary>
 /// <param name="d">BubbleDataPoint that changed its Size.</param>
 /// <param name="e">Event arguments.</param>
 private static void OnSizePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     BubbleDataPoint source = (BubbleDataPoint)d;
     double oldValue = (double)e.OldValue;
     double newValue = (double)e.NewValue;
     source.OnSizePropertyChanged(oldValue, newValue);
 }
Ejemplo n.º 3
0
 private static void RequestViewPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (d is MapView)
     {
         MapView mapView = d as MapView;
         if (e.NewValue is Geometry)
         {
             if (mapView.Extent != null)
             {
                 var _ = mapView.SetViewAsync((Geometry)e.NewValue);
             }
             else //Map not ready, wait till we have an extent and try again
             {
                 //We could just set the InitialExtent instead, but this gives a cool zoom in effect.
                 EventHandler handler = null;
                 handler = async (s, e2) =>
                     {
                         mapView.ExtentChanged -= handler;
                         await Task.Delay(500); //Wait a little so map loads a little before zooming first time (better experience)
                         var __ = mapView.SetViewAsync((Geometry)e.NewValue);
                     };
                 mapView.ExtentChanged += handler;
             }
         }
     }
 }
        /// <summary>
        /// Gets the <see cref="BehaviorCollection"/> associated with a specified object.
        /// </summary>
        /// <param name="obj">The object from which to retrieve the <see cref="BehaviorCollection"/>.</param>
        /// <returns>A <see cref="BehaviorCollection"/> containing the behaviors associated with the specified object.</returns>
        public static BehaviorCollection GetBehaviors(DependencyObject obj)
        {
            var behaviorCollection = (BehaviorCollection)obj.GetValue(BehaviorsProperty);

            if (behaviorCollection == null)
            {
#if WINDOWS_PHONE
                behaviorCollection = (BehaviorCollection)typeof(BehaviorCollection)
                    .GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, Type.EmptyTypes, null)
                    .Invoke(null);
#else
                behaviorCollection = new BehaviorCollection();
#endif

                obj.SetValue(BehaviorsProperty, behaviorCollection);
                obj.SetValue(Interaction.BehaviorsProperty, behaviorCollection);

                var frameworkElement = obj as FrameworkElement;

                if (frameworkElement != null)
                {
                    frameworkElement.Loaded -= FrameworkElement_Loaded;
                    frameworkElement.Loaded += FrameworkElement_Loaded;
                    frameworkElement.Unloaded -= FrameworkElement_Unloaded;
                    frameworkElement.Unloaded += FrameworkElement_Unloaded;
                }
            }

            return behaviorCollection;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Handles the <see cref="Mouse.PreviewMouseDownEvent"/>.
 /// </summary>
 private static void HandlePreviewMouseDown(DependencyObject element, MouseDevice device, MouseButton button, ref RoutedEventData data)
 {
     if (button == MouseButton.Left)
     {
         ((SliderBase)element).Focus();
     }
 }
        private static void OnBehaviorsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var oldBehaviorCollection = (BehaviorCollection)e.OldValue;
            var newBehaviorCollection = (BehaviorCollection)e.NewValue;

            if (oldBehaviorCollection == newBehaviorCollection)
            {
                return;
            }

            if (oldBehaviorCollection != null)
            {
#if WINDOWS_PHONE
                var associatedObject = typeof(BehaviorCollection)
                    .GetProperty("AssociatedObject", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
                    .GetValue(oldBehaviorCollection);
#else
                var associatedObject = oldBehaviorCollection.AssociatedObject;
#endif
                if (associatedObject != null)
                {
                    oldBehaviorCollection.Detach();
                }
            }

            if (newBehaviorCollection == null || d == null)
            {
                return;
            }

            newBehaviorCollection.Attach(d);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// RatioVisibleProperty property changed handler.
 /// </summary>
 /// <param name="d">PartialView that changed its RatioVisible.</param>
 /// <param name="e">Event arguments.</param>
 private static void OnRatioVisibleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     Clipper source = (Clipper)d;
     double oldValue = (double)e.OldValue;
     double newValue = (double)e.NewValue;
     source.OnRatioVisibleChanged(oldValue, newValue);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Adds a handler for the PreviewAxisChanged attached event to the specified element.
        /// </summary>
        /// <param name="element">The element to which to add the handler.</param>
        /// <param name="handler">The handler to add to the specified element.</param>
        public static void AddPreviewAxisChangedHandler(DependencyObject element, UpfGamePadAxisChangedEventHandler handler)
        {
            Contract.Require(element, "element");
            Contract.Require(handler, "handler");

            IInputElementHelper.AddHandler(element, PreviewAxisChangedEvent, handler);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// LocationProperty property changed handler.
 /// </summary>
 /// <param name="d">Axis that changed its Location.</param>
 /// <param name="e">Event arguments.</param>
 private static void OnLocationPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     Axis source = (Axis)d;
     AxisLocation oldValue = (AxisLocation)e.OldValue;
     AxisLocation newValue = (AxisLocation)e.NewValue;
     source.OnLocationPropertyChanged(oldValue, newValue);
 }
Ejemplo n.º 10
0
        //------------------------------------------------------ 
        //
        //  Public Properties 
        //
        //-----------------------------------------------------

        private static void PositionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 
        {
            PointLightBase target = ((PointLightBase) d); 
 

            target.PropertyChanged(PositionProperty); 
        }
        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------

        private static void MatrixPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MatrixTransform3D target = ((MatrixTransform3D) d);


            target.PropertyChanged(MatrixProperty);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Handles changes to the MenuFlyout DependencyProperty.
        /// </summary>
        /// <param name="o">DependencyObject that changed.</param>
        /// <param name="e">Event data for the DependencyPropertyChangedEvent.</param>
        private static void OnMenuFlyoutChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            var element = o as FrameworkElement;

            if (null != element)
            {
                // just in case we were here before and there is no new menu
                element.Holding -= OnElementHolding;

                MenuFlyout oldMenuFlyout = e.OldValue as MenuFlyout;

                if (null != oldMenuFlyout)
                {
                    // Remove previous attachment
                    element.SetValue(FlyoutBase.AttachedFlyoutProperty, null);
                }

                MenuFlyout newMenuFlyout = e.NewValue as MenuFlyout;

                if (null != newMenuFlyout)
                {
                    // attach using FlyoutBase to easier show the menu
                    element.SetValue(FlyoutBase.AttachedFlyoutProperty, newMenuFlyout);

                    // need to show it
                    element.Holding += OnElementHolding;
                }
            }
        }
Ejemplo n.º 13
0
        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------

        private static void ColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            EmissiveMaterial target = ((EmissiveMaterial) d);


            target.PropertyChanged(ColorProperty);
        }
Ejemplo n.º 14
0
        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------

        private static void DirectionPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DirectionalLight target = ((DirectionalLight) d);


            target.PropertyChanged(DirectionProperty);
        }
Ejemplo n.º 15
0
        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------

        private static void FieldOfViewPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            PerspectiveCamera target = ((PerspectiveCamera) d);


            target.PropertyChanged(FieldOfViewProperty);
        }
Ejemplo n.º 16
0
        private static void OnOtherContentTemplatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var panControl = d as PanControl;
            if (panControl == null) return;

            panControl.OnOtherContentTemplateChanged((DataTemplate)e.OldValue, (DataTemplate)e.NewValue);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// IsCheckedProperty property changed handler.
        /// </summary> 
        /// <param name="d">ToggleButton that changed its IsChecked.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs.</param>
        private static void OnIsCheckedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 
        { 
            ToggleButton source = d as ToggleButton;
            System.Diagnostics.Debug.Assert(source != null, 
                "The source is not an instance of ToggleButton!");

            System.Diagnostics.Debug.Assert(typeof(bool?).IsInstanceOfType(e.NewValue) || (e.NewValue == null), 
                "The value is not an instance of bool?!");
            bool? value = (bool?) e.NewValue;
 
            // Raise the appropriate changed event 
            RoutedEventArgs args = new RoutedEventArgs () { OriginalSource = source};
            if (value == true)
            {
                source.OnChecked(args); 
            }
            else if (value == false)
            { 
                source.OnUnchecked(args); 
            }
            else 
            {
                source.OnIndeterminate(args);
            } 
        }
Ejemplo n.º 18
0
 private static void OnIsSelecedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     var control = d as BigTabBarItem;
     if (control == null || e.NewValue == null || e.NewValue == e.OldValue) return;
     string state = (bool.Parse(e.NewValue.ToString())) ? "Selected" : "Unselected";
     VisualStateManager.GoToState(control, state, true);            
 }
Ejemplo n.º 19
0
	public static UIElement GetPlacementTarget(DependencyObject element)
	{
		if (element == null)
			throw new ArgumentNullException ("element");

		return (UIElement)element.GetValue(ToolTipService.PlacementTargetProperty);
	}
Ejemplo n.º 20
0
 public override object GetValueCore(DependencyObject d, DependencyProperty dp)
 {
     if (Source != null)
         return GetValueCore(Source);
     if (ElementName == null)
         if (d is FrameworkElement)
         {
             FrameworkElement element = (FrameworkElement)d;
             while (element != null)
             {
                 if (element.DataContext != null)
                     return GetValueCore(element.DataContext);
                 element = element.VisualParent as FrameworkElement;
             }
             return null;
         }
         else
             return null;
     if ((d is Visual) && dp == NameScope.NameScopeProperty)
         return null;
     INameScope nameScope = NameScope.GetNameScope(d);
     if (nameScope == null)
         return null;
     object source = nameScope.FindName(ElementName);
     return GetValueCore(source);
 }
        static void ModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (Execute.InDesignMode || e.NewValue == null || e.NewValue == e.OldValue)
            {
                return;
            }

            var fe = d as FrameworkElement;
            if (fe == null)
            {
                return;
            }

            View.ExecuteOnLoad(fe, delegate
            {
                var target = e.NewValue;
                var containerKey = e.NewValue as string;

                if (containerKey != null)
                {
                    target = IoC.GetInstance(null, containerKey);
                }

                d.SetValue(View.IsScopeRootProperty, true);

                var context = string.IsNullOrEmpty(fe.Name)
                                  ? fe.GetHashCode().ToString()
                                  : fe.Name;

                ViewModelBinder.Bind(target, d, context);
            });
        }
Ejemplo n.º 22
0
        private static void OnMapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ZoomSlider zs = d as ZoomSlider;
            Map newValue = e.NewValue as Map;
            Map oldValue = e.OldValue as Map;

            if (oldValue != null)
            {
                oldValue.ViewBoundsChanged -= new EventHandler<ViewBoundsEventArgs>(zs.Map_ViewBoundsChanged);
                oldValue.ViewBoundsChanging -= new EventHandler<ViewBoundsEventArgs>(zs.Map_ViewBoundsChanging);
                if (oldValue.Layers != null)
                {
                    oldValue.Layers.LayersInitialized -= new EventHandler(zs.Layers_LayersInitialized);
                }
                newValue.ResolutionsChanged -= new EventHandler<ResolutionsEventArgs>(zs.newValue_ResolutionsChanged);

            }

            if (newValue != null)
            {
                newValue.ViewBoundsChanged += new EventHandler<ViewBoundsEventArgs>(zs.Map_ViewBoundsChanged);
                newValue.ViewBoundsChanging += new EventHandler<ViewBoundsEventArgs>(zs.Map_ViewBoundsChanging);
                if (newValue.Layers != null)
                {
                    newValue.Layers.LayersInitialized += new EventHandler(zs.Layers_LayersInitialized);
                }
                //后设置Map的Scales也要起作用。
                newValue.ResolutionsChanged += new EventHandler<ResolutionsEventArgs>(zs.newValue_ResolutionsChanged);
            }
        }
Ejemplo n.º 23
0
 public VisualTreeChangeEventArgs(DependencyObject parent, DependencyObject child, int childIndex, VisualTreeChangeType changeType)
 {
     Parent = parent;
     Child = child;
     ChildIndex = childIndex;
     ChangeType = changeType;
 }
Ejemplo n.º 24
0
        /// <summary>
        ///     Called when HeaderProperty is invalidated on "d." 
        /// </summary> 
        private static void OnHeaderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        { 
            HeaderedItemsControl ctrl = (HeaderedItemsControl) d;

            ctrl.SetValue(HasHeaderPropertyKey, (e.NewValue != null) ? BooleanBoxes.TrueBox : BooleanBoxes.FalseBox);
            ctrl.OnHeaderChanged(e.OldValue, e.NewValue); 
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Parses the specified message text.
        /// </summary>
        /// <param name="target">The target.</param>
        /// <param name="text">The message text.</param>
        /// <returns>The triggers parsed from the text.</returns>
        public static IEnumerable<TriggerBase> Parse(DependencyObject target, string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return new TriggerBase[0];
            }

            var triggers = new List<TriggerBase>();
            var messageTexts = Split(text, ';');

            foreach (var messageText in messageTexts)
            {
                var triggerPlusMessage = LongFormatRegularExpression.IsMatch(messageText)
                                             ? Split(messageText, '=')
                                             : new[] { null, messageText };

                var messageDetail = triggerPlusMessage.Last()
                    .Replace("[", string.Empty)
                    .Replace("]", string.Empty)
                    .Trim();

                var trigger = CreateTrigger(target, triggerPlusMessage.Length == 1 ? null : triggerPlusMessage[0]);
                var message = CreateMessage(target, messageDetail);

                trigger.Actions.Add(message);
                triggers.Add(trigger);
            }

            return triggers;
        }
 private static void OnSizePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     PredefinedMarkerStyle style = d as PredefinedMarkerStyle;
     style.OnPropertyChanged("Size");
     style.OnPropertyChanged("OffsetX");
     style.OnPropertyChanged("OffsetY");
 }
Ejemplo n.º 27
0
		static void CheckTarget (DependencyObject target)
		{
			if (target == null)
				throw new ArgumentNullException ("target");
			if (!(target is TextBox))
				throw new ArgumentException ("target is not a TextBox", "target");
		}
Ejemplo n.º 28
0
        /// <summary>
        /// Adds a handler for the PreviewGenericInteraction attached event to the specified element.
        /// </summary>
        /// <param name="element">The element to which to add the handler.</param>
        /// <param name="handler">The handler to add to the specified element.</param>
        public static void AddPreviewTapHandler(DependencyObject element, UpfGenericInteractionEventHandler handler)
        {
            Contract.Require(element, "element");
            Contract.Require(handler, "handler");

            IInputElementHelper.AddHandler(element, PreviewGenericInteractionEvent, handler);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Removes a handler for the GenericInteraction attached event to the specified element.
        /// </summary>
        /// <param name="element">The element from which to remove the handler.</param>
        /// <param name="handler">The handler to remove from the specified element.</param>
        public static void RemoveGenericInteractionHandler(DependencyObject element, UpfTouchTapEventHandler handler)
        {
            Contract.Require(element, "element");
            Contract.Require(handler, "handler");

            IInputElementHelper.RemoveHandler(element, GenericInteractionEvent, handler);
        }
 /// <summary>
 /// MinimumDistanceBetweenChildrenProperty property changed handler.
 /// </summary>
 /// <param name="d">OrientedPanel that changed its MinimumDistanceBetweenChildren.</param>
 /// <param name="e">Event arguments.</param>
 private static void OnMinimumDistanceBetweenChildrenPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     OrientedPanel source = (OrientedPanel)d;
     double oldValue = (double)e.OldValue;
     double newValue = (double)e.NewValue;
     source.OnMinimumDistanceBetweenChildrenPropertyChanged(oldValue, newValue);
 }
 private static void OnAlignmentBoundaryChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     ((Panel)d).InvalidateMeasure();
 }
Ejemplo n.º 32
0
 public static void SetRequired(DependencyObject element, bool value) => element.SetValue(RequiredProperty, value);
Ejemplo n.º 33
0
 public static void SetColumnIndex(DependencyObject dependencyObject, int i)
 {
     dependencyObject.SetValue(ColumnIndexProperty, i);
 }
Ejemplo n.º 34
0
 public static int GetColumnIndex(DependencyObject dependencyObject)
 {
     return((int)dependencyObject.GetValue(ColumnIndexProperty));
 }
Ejemplo n.º 35
0
		void HandleValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
		{
			OnChanged(new BindingChangedEventArgs(e));
		}
Ejemplo n.º 36
0
 public static TitleAlignment GetTitleAlignment(DependencyObject element) => (TitleAlignment)element.GetValue(TitleAlignmentProperty);
Ejemplo n.º 37
0
 public static void SetTitleAlignment(DependencyObject element, TitleAlignment value) => element.SetValue(TitleAlignmentProperty, value);
Ejemplo n.º 38
0
 public static bool GetRequired(DependencyObject element) => (bool)element.GetValue(RequiredProperty);
Ejemplo n.º 39
0
 public static void SetTitle(DependencyObject element, string value) => element.SetValue(TitleProperty, value);
Ejemplo n.º 40
0
 public static string GetTitle(DependencyObject element) => (string)element.GetValue(TitleProperty);
 /// <summary>
 /// Gets the HandleKineticScrolling property.
 /// </summary>
 public static bool GetHandleKineticScrolling(DependencyObject d)
 {
     return((bool)d.GetValue(HandleKineticScrollingProperty));
 }
 /// <summary>
 /// Sets the HandleKineticScrolling property.
 /// </summary>
 public static void SetHandleKineticScrolling(DependencyObject d,
                                              bool value)
 {
     d.SetValue(HandleKineticScrollingProperty, value);
 }
 /// <summary>
 /// Gets the InertiaProcessor property.
 /// </summary>
 private static InertiaHandler GetInertiaProcessor(DependencyObject d)
 {
     return((InertiaHandler)d.GetValue(InertiaProcessorProperty));
 }
 /// <summary>
 /// Sets the InertiaProcessor property.
 /// </summary>
 private static void SetInertiaProcessor(DependencyObject d,
                                         InertiaHandler value)
 {
     d.SetValue(InertiaProcessorProperty, value);
 }
 /// <summary>
 /// Gets the ScrollStartOffset property.
 /// </summary>
 private static Point GetScrollStartOffset(DependencyObject d)
 {
     return((Point)d.GetValue(ScrollStartOffsetProperty));
 }
 /// <summary>
 /// Sets the ScrollStartOffset property.
 /// </summary>
 private static void SetScrollStartOffset(DependencyObject d,
                                          Point value)
 {
     d.SetValue(ScrollStartOffsetProperty, value);
 }
 /// <summary>
 /// Gets the Friction property.  This dependency property
 /// indicates ....
 /// </summary>
 public static double GetFriction(DependencyObject d)
 {
     return((double)d.GetValue(FrictionProperty));
 }
 /// <summary>
 /// Sets the Friction property.
 /// </summary>
 public static void SetFriction(DependencyObject d, double value)
 {
     d.SetValue(FrictionProperty, value);
 }
Ejemplo n.º 49
0
 private static void OnInput3PropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
 {
     ((MultipleInputs4Converter)sender).SetOutput(3, e.OldValue);
 }
 public static void RemoveValidationError(ValidationError validationError, DependencyObject targetElement, bool shouldRaiseEvent)
 {
     RemoveValidationErrorMethod.Invoke(null, new object [] { validationError, targetElement, shouldRaiseEvent });
 }
Ejemplo n.º 51
0
 public static bool GetAutoWireViewModel(DependencyObject obj)
 {
     return((bool)obj.GetValue(AutoWireViewModelProperty));
 }
Ejemplo n.º 52
0
 public static void SetAutoWireViewModel(DependencyObject obj, bool value)
 {
     obj.SetValue(AutoWireViewModelProperty, value);
 }
Ejemplo n.º 53
0
 /// <summary>
 /// Sets the <see cref="VirtualizationMode"/> on the specified object.
 /// </summary>
 /// <param name="element">
 /// The element on which to set the <see cref="VirtualizationMode"/>.
 /// </param>
 /// <param name="value">
 /// One of the enumeration values that specifies whether element uses container recycling.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// element is null.
 /// </exception>
 public static void SetVirtualizationMode(DependencyObject element, VirtualizationMode value)
 {
     element.SetValue(VirtualizationModeProperty, value);
 }
Ejemplo n.º 54
0
 static void OrientationChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
 {
     ((VirtualizingStackPanel)sender).InvalidateMeasure();
 }
Ejemplo n.º 55
0
 /// <summary>
 /// Установка привязанных столбцов
 /// </summary>
 /// <param name="element">Элемент</param>
 /// <param name="value">Значение</param>
 public static void SetBindableColumns(DependencyObject element, ObservableCollection<DataGridColumn> value)
 {
     element.SetValue(BindableColumnsProperty, value);
 }
 private static void OnAlignOnLesserEdgeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     ((Panel)d).InvalidateMeasure();
 }
Ejemplo n.º 57
0
 private static void OnIsSelectedChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
 {
     ((ViewElement)obj).OnIsSelectedChanged();
 }
Ejemplo n.º 58
0
 private static void OnParentChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
 {
     ((ViewElement)obj).OnParentChanged((ViewGroup)args.OldValue);
 }
Ejemplo n.º 59
0
        public override Style SelectStyle(object item, DependencyObject container)
        {
            IBubbleDataPoint dataPoint = (IBubbleDataPoint)item;

            return(dataPoint.BubbleSize.Value > 0 ? this.PositiveStyle : this.NegativeStyle);
        }
 private static void OnOrientationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     ((Panel)d).InvalidateMeasure();
 }