Ejemplo n.º 1
0
        internal override void TryFocusCell(DataGridCellInfo cellInfo, FocusState state)
        {
            base.TryFocusCell(cellInfo, state);

            if (cellInfo.Cell == null)
            {
                return;
            }

            var element = cellInfo.Cell.Container as FrameworkElement;

            if (element != null)
            {
                var control = element as Control;
                if (control != null)
                {
                    control.Focus(state);
                }
                else
                {
                    var firstControl = ElementTreeHelper.FindVisualDescendant <Control>(element);
                    if (firstControl != null)
                    {
                        firstControl.Focus(state);
                    }
                }
            }
        }
        /// <summary>
        /// Occurs when a System.Windows.FrameworkElement has been constructed and added to the object tree.
        /// </summary>
        protected override void OnLoaded()
        {
            base.OnLoaded();

            if (this.itemAddedAnimationCache != null)
            {
                this.itemAddedAnimationCache.Ended -= this.OnItemAddedAnimation_Ended;
                this.itemAddedAnimationCache.Ended += this.OnItemAddedAnimation_Ended;
            }

            if (this.itemRemovedAnimationCache != null)
            {
                this.itemRemovedAnimationCache.Ended -= this.OnItemRemovedAnimation_Ended;
                this.itemRemovedAnimationCache.Ended += this.OnItemRemovedAnimation_Ended;
            }

            this.UpdateStrategyDefinitionPropertyChangedHandling(true);
            this.virtualizationStrategyDefinition.SynchStrategyProperties(this.virtualizationStrategy);

            if (this.scrollContentPresenter == null)
            {
                this.scrollContentPresenter = ElementTreeHelper.FindVisualDescendant <ScrollContentPresenter>(this.manipulationContainer);
            }

            this.BalanceVisualSpace();
        }
        /// <summary>
        /// IRangeValueProvider implementation.
        /// </summary>
        public void SetValue(double value)
        {
            var rangeSliderPrimitive = ElementTreeHelper.FindVisualDescendant <RangeSliderPrimitive>(this.SliderBase);

            if (rangeSliderPrimitive != null)
            {
                var currentValue = rangeSliderPrimitive.VisualSelection.End - rangeSliderPrimitive.VisualSelection.Start;
                if (this.hasMaximumDirection)
                {
                    if (value > currentValue)
                    {
                        rangeSliderPrimitive.UpdateSelectionEnd(this.LargeChange, true);
                    }
                    else
                    {
                        rangeSliderPrimitive.UpdateSelectionStart(this.LargeChange, true);
                    }
                }
                else
                {
                    if (value > currentValue)
                    {
                        rangeSliderPrimitive.UpdateSelectionStart(-this.LargeChange, true);
                    }
                    else
                    {
                        rangeSliderPrimitive.UpdateSelectionEnd(-this.LargeChange, true);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void OnToggleSwitchEditorLoaded(object sender, RoutedEventArgs e)
        {
            this.switchKnobRect       = ElementTreeHelper.FindVisualDescendant <Rectangle>(this.EditorControl, a => a.GetType() == typeof(Rectangle) && ((Rectangle)a).Name == SwitchKnobBoundsPartName);
            this.switchKnobOffEllipse = ElementTreeHelper.FindVisualDescendant <Ellipse>(this.EditorControl, a => a.GetType() == typeof(Ellipse) && ((Ellipse)a).Name == SwitchKnobOffPartName);
            this.outerBorderRect      = ElementTreeHelper.FindVisualDescendant <Rectangle>(this.EditorControl, a => a.GetType() == typeof(Rectangle) && ((Rectangle)a).Name == OuterBorderPartName);

            this.UpdateSwitchBrushes();
            this.EditorControl.Loaded -= this.OnToggleSwitchEditorLoaded;
        }
 private void OnLoaded(object sender, RoutedEventArgs e)
 {
     this.closeButton          = ElementTreeHelper.FindVisualDescendant <Button>(this);
     this.closeButton.Click   += this.OnCloseButtonClick;
     this.closeButtonAnimation = new OpacityAnimation(this.closeButton)
     {
         Duration = new Duration(TimeSpan.FromMilliseconds(200))
     };
     this.initialDelayTimer.Start();
 }
        private void OnNativeSideDrawerLoaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            RadSideDrawer nativeSideDrawer = (RadSideDrawer)sender;
            Border        swipeBorder      = ElementTreeHelper.FindVisualDescendant <Border>(nativeSideDrawer);

            if (swipeBorder != null)
            {
                swipeBorder.IsHitTestVisible = false;
            }

            nativeSideDrawer.Loaded -= this.OnNativeSideDrawerLoaded;
        }
Ejemplo n.º 7
0
        private void radSlideView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            RadSlideView slideView = sender as RadSlideView;

            if (slideView != null)
            {
                var scrollViewer = ElementTreeHelper.FindVisualDescendant <ScrollViewer>(slideView.SelectedItemContainer);
                if (scrollViewer != null)
                {
                    scrollViewer.ScrollToVerticalOffset(0);
                }
            }
        }
Ejemplo n.º 8
0
        private void OnSlideViewLoaded(object sender, RoutedEventArgs e)
        {
            // Start always with the information visible
            SlideViewAndFilmStrip.ShowOverlayContent();

            // Start the timer. If the user does not do anything in a few seconds then remove the overlay
            //_overlayTimer = new Timer(HideOverlayAndAppbar, null, new TimeSpan(0,0,10), new TimeSpan(0,0,0,0,-1));

            SetMoveButtons();

            // Bind to item state changed event to explicit release the image when scrolling in filmstrip mode.
            var zoomableListBox = ElementTreeHelper.FindVisualDescendant <ZoomableListBox>(sender as RadSlideView);

            zoomableListBox.ItemStateChanged += ZoomableListBoxOnItemStateChanged;
        }
Ejemplo n.º 9
0
        private FrameworkElement GetVisualContent()
        {
            var content = this.Content;

            if (content == null)
            {
                return(null);
            }

            FrameworkElement visualContent = this.Content as FrameworkElement;

            if (visualContent == null)
            {
                visualContent = ElementTreeHelper.FindVisualDescendant <TextBlock>(this);
            }

            return(visualContent);
        }
Ejemplo n.º 10
0
        /// <inheritdoc />
        protected override string GetNameCore()
        {
            if (this.Control.Content != null)
            {
                var textBlock = ElementTreeHelper.FindVisualDescendant <Windows.UI.Xaml.Controls.TextBlock>(this.Control);
                if (textBlock != null)
                {
                    return(textBlock.Text);
                }
            }

            var nameCore = base.GetNameCore();

            if (!string.IsNullOrEmpty(nameCore))
            {
                return(nameCore);
            }

            return(string.Empty);
        }