Inheritance: FrameworkElement, IPanel
示例#1
0
        /// <summary>
        /// Builds the visual tree for the ColorPicker control when the template is applied. 
        /// </summary>
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            m_rootElement = GetTemplateChild("RootElement") as Panel;
            m_hueMonitor = GetTemplateChild("HueMonitor") as Rectangle;
            m_sampleSelector = GetTemplateChild("SampleSelector") as Canvas;
            m_hueSelector = GetTemplateChild("HueSelector") as Canvas;
            m_selectedColorView = GetTemplateChild("SelectedColorView") as Rectangle;
            m_colorSample = GetTemplateChild("ColorSample") as Rectangle;
            m_hexValue = GetTemplateChild("HexValue") as TextBlock;


            m_rootElement.RenderTransform = m_scale = new ScaleTransform();

            m_hueMonitor.PointerPressed += m_hueMonitor_PointerPressed;
            m_hueMonitor.PointerReleased += m_hueMonitor_PointerReleased;
            m_hueMonitor.PointerMoved += m_hueMonitor_PointerMoved;

            m_colorSample.PointerPressed += m_colorSample_PointerPressed;
            m_colorSample.PointerReleased += m_colorSample_PointerReleased;
            m_colorSample.PointerMoved += m_colorSample_PointerMoved;

            m_sampleX = m_colorSample.Width;
            m_sampleY = 0;
            m_huePos = 0;

            UpdateVisuals();
        }
示例#2
0
        public Human(Windows.UI.Xaml.Controls.Panel canvas)
        {
            this.canvas = canvas;

            body     = new Body();
            head     = new Head(body.Center, new Point(0, -90), this);
            leftArm  = new Arm(body.Center, new Point(-30, -80), Util.FromPolar(50, Math.PI * 0.7), Util.FromPolar(50, Math.PI), this);
            rightArm = leftArm.Mirror();
            leftLeg  = new Arm(body.Center, new Point(0, 0), Util.FromPolar(60, Math.PI * 0.6), Util.FromPolar(50, Math.PI * 0.5), this);
            rightLeg = leftLeg.Mirror();
            arms     = new[] { leftArm, leftLeg, rightArm, rightLeg };

            bodyShape = new Polygon()
            {
                Points = new Windows.UI.Xaml.Media.PointCollection()
                {
                    leftArm.Root.GetAbsolutePosition(), rightArm.Root.GetAbsolutePosition(), leftLeg.Root.GetAbsolutePosition()
                }
            };
            canvas.Children.Add(bodyShape);
            AddShapes(head.Shapes);
            head.UpdateShape();
            foreach (var arm in arms)
            {
                AddShapes(arm.Shapes);
            }
            State = new StateManager(this);
            State.Push();
        }
示例#3
0
        public static void ShowAttachedFlyoutAtPointer(FrameworkElement flyoutOwner, Panel rootPanel)
        {
            var point = PointerHelper.GetPosition();

            // if no pointer, display at the flyout owner
            if (point == null)
            {
                FlyoutBase.ShowAttachedFlyout(flyoutOwner);
                return;
            }

            var bounds = rootPanel.TransformToVisual(Window.Current.Content).TransformPoint(new Point(0, 0));

            var tempGrid = new Grid
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Top,
                Margin = new Thickness(point.Value.X - bounds.X, point.Value.Y - bounds.Y, 0, 0)
            };

            rootPanel.Children.Add(tempGrid);
            var flyout = FlyoutBase.GetAttachedFlyout(flyoutOwner);
            EventHandler<object> handler = null;
            handler = (o, o1) =>
            {
                rootPanel.Children.Remove(tempGrid);
                flyout.Closed -= handler;
            };
            flyout.Closed += handler;
            flyout.ShowAt(tempGrid);
        }
示例#4
0
 /// <summary>
 /// Attaches the layer to the root layout panel of the page.
 /// </summary>
 /// <param name="panel">Panel instance to attach to.</param>
 internal void AttachToPage(Panel panel)
 {
     if (panel == null) throw new ArgumentNullException("panel");
     this.SetValue(Grid.ColumnSpanProperty, 100);
     this.SetValue(Grid.RowSpanProperty, 100);
     panel.Children.Add(this);
 }
示例#5
0
        protected override void OnApplyTemplate()
        {
            _frame = base.GetTemplateChild("frame") as Panel;
            _panel = base.GetTemplateChild("panel") as CarouselPanel;

            _arrows = base.GetTemplateChild("arrows") as Grid;
            _left = base.GetTemplateChild("left") as Button;
            _right = base.GetTemplateChild("right") as Button;

            _gradient = base.GetTemplateChild("gradient") as LinearGradientBrush;
            _clip = base.GetTemplateChild("clip") as RectangleGeometry;

            _frame.ManipulationDelta += OnManipulationDelta;
            _frame.ManipulationCompleted += OnManipulationCompleted;
            _frame.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.System;

            _frame.PointerMoved += OnPointerMoved;
            _left.Click += OnLeftClick;
            _right.Click += OnRightClick;
            _left.PointerEntered += OnArrowPointerEntered;
            _left.PointerExited += OnArrowPointerExited;
            _right.PointerEntered += OnArrowPointerEntered;
            _right.PointerExited += OnArrowPointerExited;

            base.OnApplyTemplate();
        }
        protected internal override void AttachUI(Windows.UI.Xaml.Controls.Panel parent)
        {
            base.AttachUI(parent);

            this.busyControl = new DataGridBusyOverlayControl();
            this.AddVisualChild(this.busyControl);

            this.OnDataStatusChanged(this.currentStatus);
        }
        public static void Initialize(Panel panel)
        {
            InitializeOutputWindow();
            IniitalizeScrollViewer();

            panel.Children.Add(ScrollViewer);

            IsInitialized = true;
        }
            public MediaElementContainer(Panel parent)
            {
                parent.Children.Add(this);
                mediaElement = new MediaElement() { Width = 200 };

                this.Content = mediaElement;
                mediaElement.Source = new Uri(parent.BaseUri, mediaUri);
                this.IsTabStop = true;
                AutomationProperties.SetAutomationId(mediaElement, "MediaElement1");
                AutomationProperties.SetName(mediaElement, "MediaElement");
            }
		public VisualElementPackager(IVisualElementRenderer renderer)
		{
			if (renderer == null)
				throw new ArgumentNullException("renderer");

			_renderer = renderer;

			_panel = renderer.ContainerElement as Panel;
			if (_panel == null)
				throw new ArgumentException("Renderer's container element must be a Panel");
		}
示例#10
0
 protected override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     _captureElement      = GetTemplateChild(CaptureElementName) as CaptureElement;
     _webCamSelectorPopup = GetTemplateChild(WebCamSelectorPopupName) as Popup;
     _webCamSelector      = GetTemplateChild(WebCamSelectorName) as Selector;
     _recordingIndicator  = GetTemplateChild(RecordingIndicatorName) as LayoutPanel;
     _recordingAnimation  = GetTemplateChild(RecordingAnimationName) as Storyboard;
     _countdownControl    = GetTemplateChild(CountdownControlName) as CountdownControl;
     _flashAnimation      = GetTemplateChild(FlashAnimationName) as Storyboard;
 }
        protected override void OnApplyTemplate()
        {
            // Apply the template
            base.OnApplyTemplate();

            // Find the container for our display content
            contentPanel = GetTemplateChild(ContentPanelName) as Panel;

            // If it's missing, major error
            if (contentPanel == null) { throw new MissingTemplateElementException(ContentPanelName, nameof(GraphicsDisplayPanel)); }
        }
        public void MonitorControl(Panel panel)
        {
            Monitor = new Rectangle {Fill = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0))};
			Monitor.SetValue(Grid.RowSpanProperty, int.MaxValue - 1);
			Monitor.SetValue(Grid.ColumnSpanProperty, int.MaxValue - 1);

	        Monitor.ManipulationMode = ManipulationModes.All;
			Monitor.ManipulationStarted += MonitorManipulationStarted;
			Monitor.ManipulationDelta += MonitorManipulationDelta;

            panel.Children.Add(Monitor);
        }
示例#13
0
        public SequencePage(Panel tempPanel, String procedureName, PDU pdu, Procedure tempProcedure, StreamSocket tempSocket)
        {
            newSocket = tempSocket;
            localProcedure = tempProcedure;
            procedure = procedureName;
            tempPDU = pdu;
            panel2 = tempPanel;
            this.InitializeComponent();
            procedureTextBlock.Text = procedureName;

            loadSequences();
        }
示例#14
0
 public static void AddWebViewWithBinding(Panel parent, object source, string path)
 {
     RemoveParent();
     _webViewInstance.SetBinding(WebViewExtend.ContentProperty, new Binding() { Source = source, Path = new PropertyPath(path) });
     lock(_parentLocker)
     {
         parent.Children.Add(_webViewInstance);
         if (!_webViewParents.Contains(parent))
         {
             _webViewParents.Add(parent);
         }
     }
 }
示例#15
0
 /// <summary>${controls_SliderElement_method_onApplyTemplate_D}</summary>
 protected override void OnApplyTemplate()
 {
     base.OnApplyTemplate();
     this.trackPanel = base.GetTemplateChild("TrackPanel") as Panel;
     this.thumb = base.GetTemplateChild("ThumbElement") as Thumb;
     if (this.thumb != null)
     {
         this.thumb.DragStarted += new DragStartedEventHandler(this.OnThumbDragStarted);
         this.thumb.DragDelta += new DragDeltaEventHandler(this.OnThumbDragDelta);
         this.thumb.DragCompleted += new DragCompletedEventHandler(this.OnThumbDragCompleted);
     }
     this.bufferElement = base.GetTemplateChild("Buffer") as Rectangle;
     this.UpdateTrackMarks();
 }
示例#16
0
        public AttachedProgress(Panel parentElement, double width, double height)
        {
            ParentElement = parentElement;
            isActive = false;
            popup = new Popup();
            progressRing = new ProgressRing();
            progressRing.IsActive = false;

            progressRing.VerticalAlignment = VerticalAlignment.Stretch;
            progressRing.HorizontalAlignment = HorizontalAlignment.Stretch;
            Width = width;
            Height = height;
            popup.Child = progressRing;

            parentElement.Children.Add(popup);
        }
示例#17
0
        protected override void OnApplyTemplate()
        {
            // Apply new template
            base.OnApplyTemplate();
            // Find template parts
            _transformRoot = GetTemplateChild(TransformRootName) as Grid;
            _contentPresenter = GetTemplateChild(PresenterName) as ContentPresenter;
            _matrixTransform = new MatrixTransform();
            if (null != _transformRoot)
            {
                _transformRoot.RenderTransform = _matrixTransform;
            }

            // Apply the current transform
            ApplyLayoutTransform();
        }
示例#18
0
        protected override void OnApplyTemplate()
        {
            _splitView = base.GetTemplateChild("splitView") as SplitView;
            _toggle = base.GetTemplateChild("toggle") as Button;
            _exitFS = base.GetTemplateChild("exitFS") as Button;
            _headerContainer = base.GetTemplateChild("headerContainer") as Panel;
            _commandBarContainer = base.GetTemplateChild("commandBarContainer") as ContentControl;
            _paneHeaderContainer = base.GetTemplateChild("paneHeaderContainer") as ContentControl;
            _lview = base.GetTemplateChild("lview") as ListView;
            _lviewSub = base.GetTemplateChild("lviewSub") as ListView;
            _container = base.GetTemplateChild("container") as Panel;
            _content = base.GetTemplateChild("content") as Panel;

            _topPane = base.GetTemplateChild("topPane") as ContentControl;
            _rightPane = base.GetTemplateChild("rightPane") as ContentControl;

            if (ListViewItemContainerStyle != null)
            {
                _lview.ItemContainerStyleSelector = new NavigationStyleSelector(ListViewItemContainerStyle, this.SeparatorStyle);
                _lviewSub.ItemContainerStyleSelector = new NavigationStyleSelector(ListViewItemContainerStyle, this.SeparatorStyle);
            }
            else
            {
                _lview.ItemContainerStyleSelector = new NavigationStyleSelector(_lview.ItemContainerStyle, this.SeparatorStyle);
                _lviewSub.ItemContainerStyleSelector = new NavigationStyleSelector(_lview.ItemContainerStyle, this.SeparatorStyle);
            }            
            _lview.ItemContainerStyle = null;            
            _lviewSub.ItemContainerStyle = null;

            _toggle.Click += OnToggleClick;
            _exitFS.Click += OnExitFSClick;
            _splitView.PaneClosed += OnPaneClosed;
            _lview.ItemClick += OnItemClick;
            _lviewSub.ItemClick += OnItemClick;
            _lview.SelectionChanged += OnSelectionChanged;

            _isInitialized = true;

            this.SelectFirstNavigationItem();

            SetDisplayMode(this.DisplayMode);
            SetCommandBar(_commandBar);
            SetCommandBarVerticalAlignment(this.CommandBarVerticalAlignment);
            SetPaneHeader(_paneHeader);

            base.OnApplyTemplate();
        }
示例#19
0
        protected override void OnApplyTemplate()
        {
            _frame = base.GetTemplateChild("frame") as Panel;

            _headerContainer = base.GetTemplateChild("headerContainer") as Panel;
            _header = base.GetTemplateChild("header") as PivoramaPanel;
            _header.SelectedIndexChanged += OnSelectedIndexChanged;

            _tabsContainer = base.GetTemplateChild("tabsContainer") as Panel;
            _tabs = base.GetTemplateChild("tabs") as PivoramaTabs;
            _tabs.SelectedIndexChanged += OnSelectedIndexChanged;

            _panelContainer = base.GetTemplateChild("panelContainer") as Panel;
            _panel = base.GetTemplateChild("panel") as PivoramaPanel;

            _arrows = base.GetTemplateChild("arrows") as Grid;
            _left = base.GetTemplateChild("left") as Button;
            _right = base.GetTemplateChild("right") as Button;

            _clip = base.GetTemplateChild("clip") as RectangleGeometry;

            _frame.ManipulationDelta += OnManipulationDelta;
            _frame.ManipulationCompleted += OnManipulationCompleted;
            _frame.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateInertia | ManipulationModes.System;
            _frame.PointerWheelChanged += OnPointerWheelChanged;

            _panelContainer.ManipulationDelta += OnManipulationDelta;
            _panelContainer.ManipulationCompleted += OnManipulationCompleted;
            _panelContainer.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateInertia | ManipulationModes.System;

            _frame.PointerMoved += OnPointerMoved;
            _left.Click += OnLeftClick;
            _right.Click += OnRightClick;
            _left.PointerEntered += OnArrowPointerEntered;
            _left.PointerExited += OnArrowPointerExited;
            _right.PointerEntered += OnArrowPointerEntered;
            _right.PointerExited += OnArrowPointerExited;

            _isInitialized = true;

            this.ItemWidthEx = this.ItemWidth;

            this.SizeChanged += OnSizeChanged;

            base.OnApplyTemplate();
        }
        private static async Task SaveScreenshotInternal(StorageFile file, Panel parent, InkCanvas inkCanvas = null, List<FrameworkElement> excludedElements = null)
        {
            var strokeCanvas = new Canvas() { Name = _strokeCanvasName, Background = new SolidColorBrush(Colors.Transparent) };
            if (inkCanvas != null)
            {
                // add all inkCanvas strokes as children of the parent panel,
                // allowing us to save those with the RenderTargetBitmap
                RenderAllStrokes(inkCanvas, strokeCanvas);
                parent.Children.Add(strokeCanvas);
            }

            if (excludedElements != null)
            {
                foreach (FrameworkElement element in excludedElements)
                {
                    element.Visibility = Visibility.Collapsed;
                }
            }

            await SaveToFileAsync(parent, file);

            if (inkCanvas != null)
            {
                // HACK: there's an appearant bug in InkCanvas causing strokes to disappear after the rendering
                // we need to ensure the inkcanvas is updated.
                inkCanvas.Width += 1;
                inkCanvas.Width -= 1;

                parent.Children.Remove(strokeCanvas);
            }

            if (excludedElements != null)
            {
                foreach (FrameworkElement element in excludedElements)
                {
                    element.Visibility = Visibility.Visible;
                }
            }
        }
示例#21
0
        protected override void OnApplyTemplate()
        {
            _frame = base.GetTemplateChild("frame") as Panel;
            _panel = base.GetTemplateChild("panel") as SliderViewPanel;

            _arrows = base.GetTemplateChild("arrows") as Grid;
            _left = base.GetTemplateChild("left") as Button;
            _right = base.GetTemplateChild("right") as Button;

            _clip = base.GetTemplateChild("clip") as RectangleGeometry;

            _frame.ManipulationDelta += OnManipulationDelta;
            _frame.ManipulationCompleted += OnManipulationCompleted;
            _frame.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.System;

            this.PointerEntered += OnPointerEntered;
            this.PointerExited += OnPointerExited;
            _left.Click += OnPrevArrowClick;
            _right.Click += OnNextArrowClick;

            base.OnApplyTemplate();
        }
        private async Task CloseAsync()
        {
            if (!_shown)
            {
                throw new InvalidOperationException("The dialog isn't shown, so it can't be closed.");
            }

            await this.GoToVisualStateAsync(_layoutRoot, PopupStatesGroupName, ClosedPopupStateName);
            _dialogPopup.IsOpen = false;
            _buttonsPanel.Children.Clear();

            foreach (var button in _buttons)
            {
                button.Click -= OnButtonClick;
                button.KeyUp -= OnGlobalKeyUp;
            }

            _buttons.Clear();

            _dialogPopup.Child = null;

            if (_parentPanel != null)
            {
                _parentPanel.Children.Remove(_dialogPopup);
                _parentPanel.Children.Add(this);
                _parentPanel.SizeChanged -= OnParentSizeChanged;
                _parentPanel = null;
            }

            if (_parentContentControl != null)
            {
                _parentContentControl.Content = this;
                _parentContentControl.SizeChanged -= OnParentSizeChanged;
                _parentContentControl = null;
            }

            if (_temporaryParentPanel != null)
            {
                _temporaryParentPanel.Children.Remove(_dialogPopup);
                _temporaryParentPanel.SizeChanged -= OnParentSizeChanged;
                _temporaryParentPanel = null;
            }

            _dialogPopup = null;
            this.Visibility = Visibility.Collapsed;
            _shown = false;
        }
        public async Task<string> ShowAsync(string title, string text, params string[] buttonTexts)
        {
            if (_shown)
            {
                throw new InvalidOperationException("The dialog is already shown.");
            }

            this.Visibility = Visibility.Visible;
            _shown = true;
            //this.Focus(Windows.UI.Xaml.FocusState.Programmatic);
            Window.Current.Content.KeyUp += OnGlobalKeyUp;
            _dismissTaskSource = new TaskCompletionSource<string>();

            _parentPanel = this.Parent as Panel;
            _parentContentControl = this.Parent as ContentControl;

            if (_parentPanel != null)
            {
                _parentPanel.Children.Remove(this);
            }

            if (_parentContentControl != null)
            {
                _parentContentControl.Content = null;
            }

            _dialogPopup = new Popup { Child = this };

            if (_parentPanel != null)
            {
                _parentPanel.Children.Add(_dialogPopup);
                _parentPanel.SizeChanged += OnParentSizeChanged;
            }
            else if (_parentContentControl != null)
            {
                _parentContentControl.Content = _dialogPopup;
                _parentContentControl.SizeChanged += OnParentSizeChanged;
            }
            else
            {
                _temporaryParentPanel = Window.Current.Content.GetFirstDescendantOfType<Panel>();

                if (_temporaryParentPanel != null)
                {
                    _temporaryParentPanel.Children.Add(_dialogPopup);
                    _temporaryParentPanel.SizeChanged += OnParentSizeChanged;
                }
            }

            _dialogPopup.IsOpen = true;
            await this.WaitForLayoutUpdateAsync();
            _titleTextBlock.Text = title;
            _textTextBlock.Text = text;

            _buttons = new List<ButtonBase>();

            foreach (var buttonText in buttonTexts)
            {
                var button = new Button();

                if (this.ButtonStyle != null)
                {
                    button.Style = this.ButtonStyle;
                }

                button.Content = buttonText;
                button.Click += OnButtonClick;
                button.KeyUp += OnGlobalKeyUp;
                _buttons.Add(button);
                _buttonsPanel.Children.Add(button);
            }

            _inputTextBox.Focus(Windows.UI.Xaml.FocusState.Programmatic);

            ResizeLayoutRoot();

            // Show dialog
            await this.GoToVisualStateAsync(_layoutRoot, PopupStatesGroupName, OpenPopupStateName);

            // Wait for button click
            var result = await _dismissTaskSource.Task;

            // Hide dialog
            if (this.AwaitsCloseTransition)
            {
                await this.CloseAsync();
            }
            else
            {
#pragma warning disable 4014
                this.CloseAsync();
#pragma warning restore 4014
            }

            Window.Current.Content.KeyUp -= OnGlobalKeyUp;

            return result;
        }
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            _layoutRoot = GetTemplateChild(LayoutRootPanelName) as Panel;
            _contentBorder = GetTemplateChild(ContentBorderName) as Border;
            _inputTextBox = GetTemplateChild(InputTextBoxName) as TextBox;
            _titleTextBlock = GetTemplateChild(TitleTextBlockName) as TextBlock;
            _textTextBlock = GetTemplateChild(TextTextBlockName) as TextBlock;
            _buttonsPanel = GetTemplateChild(ButtonsPanelName) as Panel;

            //_inputTextBox.SetBinding(
            //    TextBox.TextProperty,
            //    new Binding
            //    {
            //        Path = new PropertyPath("InputText"),
            //        Source = this,
            //        Mode = BindingMode.TwoWay
            //    });

            _layoutRoot.Tapped += OnLayoutRootTapped;
            _inputTextBox.Text = this.InputText;
            _inputTextBox.TextChanged += OnInputTextBoxTextChanged;
            _inputTextBox.KeyUp += OnInputTextBoxKeyUp;
            _contentBorder.Tapped += OnContentBorderTapped;
        }
 protected override void OnApplyTemplate()
 {
     _commandPandel = this.GetTemplateChild("PART_CommandPanel") as Panel;
     if (_commandPandel != null)
     {
         _commandPandel.AddHandler(RadialMenuExtensionButton.PointerEnteredEvent, new PointerEventHandler(this.OnPointerEntered), false);
         _commandPandel.AddHandler(RadialMenuExtensionButton.PointerExitedEvent, new PointerEventHandler(this.OnPointerExited), false);
         _commandPandel.AddHandler(RadialMenuExtensionButton.PointerReleasedEvent, new PointerEventHandler(this.OnPointerReleased), false);
     }
 }
        /// <summary>
        /// Invoked whenever application code or internal processes (such as a rebuilding layout pass) call ApplyTemplate. In simplest terms, this means the method is called just before a UI element displays in your app. Override this method to influence the default post-template logic of a class.
        /// </summary>
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _pagePresentersPanel = (Panel)GetTemplateChild(PagePresentersPanelName);
            _waitForApplyTemplateTaskSource.SetResult(true);
        } 
        /// <summary>
        /// When overridden in a derived class, is invoked whenever application code or internal processes (such as a rebuilding layout pass) call <see cref="M:FrameworkElement.ApplyTemplate()"/>.
        /// In simplest terms, this means the method is called just before a UI element displays in an application.
        /// For more information, see Remarks.
        /// </summary>
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // Find the template parts. Create dummy objects if parts are missing to avoid
            // null checks throughout the code (although we can't escape them completely.)
            _itemsPanel = GetTemplateChild(ItemsPanelName) as Panel ?? new Canvas();
            _centeringTransform = GetTemplateChild(CenteringTransformName) as TranslateTransform ?? new TranslateTransform();
            _panningTransform = GetTemplateChild(PanningTransformName) as TranslateTransform ?? new TranslateTransform();

            CreateVisuals();
        }
示例#28
0
		internal YGridLines_Internal(Panel container, ScaleType scaleType, double[] points, double minimum, double maximum, double thickness, ChartObjectTag tag, Style lineStyle)
			: base(container, scaleType, points, minimum, maximum, thickness, tag, lineStyle)
		{ }
示例#29
0
        public override void SetValue(ShibaObject shibaObject, View targetShibaView, NativeView element, NativeViewGroup parent)
        {
            var row        = shibaObject.Get <int>("row");
            var column     = shibaObject.Get <int>("column");
            var rowSpan    = shibaObject.Get <int>("rowSpan");
            var columnSpan = shibaObject.Get <int>("columnSpan");

            if (row != default)
            {
                Grid.SetRow(element, row);
            }

            if (column != default)
            {
                Grid.SetColumn(element, column);
            }

            if (rowSpan != default)
            {
                Grid.SetRowSpan(element, rowSpan);
            }

            if (columnSpan != default)
            {
                Grid.SetColumnSpan(element, columnSpan);
            }
        }
示例#30
0
        private Storyboard CreateEnterAnimation(Windows.UI.Xaml.Controls.Panel layoutRoot)
        {
            var enterAnimation = new Storyboard();

            // Use the AnimationDescription object if available. Otherwise, return an empty storyboard (no animation).
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.Core.AnimationMetrics.AnimationDescription"))
            {
                Storyboard.SetTarget(enterAnimation, layoutRoot);

                var ad = new AnimationDescription(AnimationEffect.EnterPage, AnimationEffectTarget.Primary);
                for (int i = 0; i < layoutRoot.Children.Count; i++)
                {
                    // Add a render transform to the existing one just for animations
                    var element = layoutRoot.Children[i];
                    var tg      = new TransformGroup();
                    tg.Children.Add(new TranslateTransform());
                    tg.Children.Add(element.RenderTransform);
                    element.RenderTransform = tg;

                    // Calculate the stagger for each animation. Note that this has a max
                    var delayMs = Math.Min(ad.StaggerDelay.TotalMilliseconds * i * ad.StaggerDelayFactor, ad.DelayLimit.Milliseconds);
                    var delay   = TimeSpan.FromMilliseconds(delayMs);

                    foreach (var description in ad.Animations)
                    {
                        var animation = new DoubleAnimationUsingKeyFrames();

                        // Start the animation at the right offset
                        var startSpline = new SplineDoubleKeyFrame();
                        startSpline.KeyTime = TimeSpan.FromMilliseconds(0);
                        Storyboard.SetTarget(animation, element);

                        // Hold at that offset until the stagger delay is hit
                        var middleSpline = new SplineDoubleKeyFrame();
                        middleSpline.KeyTime = delay;

                        // Animation from delayed time to last time
                        var endSpline = new SplineDoubleKeyFrame();
                        endSpline.KeySpline = new KeySpline()
                        {
                            ControlPoint1 = description.Control1, ControlPoint2 = description.Control2
                        };
                        endSpline.KeyTime = description.Duration + delay;

                        // Do the translation
                        if (description.Type == PropertyAnimationType.Translation)
                        {
                            startSpline.Value  = ANIMATION_TRANSLATION_START;
                            middleSpline.Value = ANIMATION_TRANSLATION_START;
                            endSpline.Value    = ANIMATION_TRANSLATION_END;

                            Storyboard.SetTargetProperty(animation, "(UIElement.RenderTransform).(TransformGroup.Children)[0].X");
                        }
                        // Opacity
                        else if (description.Type == PropertyAnimationType.Opacity)
                        {
                            startSpline.Value  = ANIMATION_OPACITY_START;
                            middleSpline.Value = ANIMATION_OPACITY_START;
                            endSpline.Value    = ANIMATION_OPACITY_END;

                            Storyboard.SetTargetProperty(animation, "Opacity");
                        }
                        else
                        {
                            throw new Exception("Encountered an unexpected animation type.");
                        }

                        // Put the final animation together
                        animation.KeyFrames.Add(startSpline);
                        animation.KeyFrames.Add(middleSpline);
                        animation.KeyFrames.Add(endSpline);
                        enterAnimation.Children.Add(animation);
                    }
                }
            }
            return(enterAnimation);
        }
 public static void SetRootPanel(Windows.UI.Xaml.Controls.Panel panel)
 {
     //System.Threading.Thread thread = System.Threading.Thread.CurrentThread;
     AdDealsWrapperUWP.rootPanel = panel;
 }
示例#32
0
 /// <summary>
 /// Apply a control template to the ItemsControl.
 /// </summary>
 internal void OnApplyTemplate()
 {
     // Clear the cached ItemsHost, ScrollHost
     _itemsHost = null;
     _scrollHost = null;
 }
 /// <summary>
 /// Insert grid containing data point used for legend item into the 
 /// plot area.
 /// </summary>
 /// <param name="oldValue">The old plot area.</param>
 /// <param name="newValue">The new plot area.</param>
 protected override void OnPlotAreaChanged(Panel oldValue, Panel newValue)
 {
     if (newValue != null)
     {
         CreateLegendItemDataPoint();
     }
     base.OnPlotAreaChanged(oldValue, newValue);
 }
示例#34
0
		internal YGridLabels_Internal(LolloChart root, Panel container, ScaleType scaleType, Tuple<double, string>[] points, string dataPointsFormat, ChartObjectTag tag)
			: base(root, container, scaleType, points, dataPointsFormat, tag)
		{ }
        private LoopingSelectorItem CreateAndAddItem(Panel parent, object content)
        {
            bool reuse = _temporaryItemsPool != null && _temporaryItemsPool.Count > 0;

            LoopingSelectorItem wrapper = reuse ? _temporaryItemsPool.Dequeue() : new LoopingSelectorItem();

            if (!reuse)
            {
                wrapper.ContentTemplate = this.ItemTemplate;
                wrapper.Width = ItemSize.Width;
                wrapper.Height = ItemSize.Height;

                wrapper.Padding = ItemPadding;

                wrapper.Click += OnWrapperClick;
            }

            wrapper.DataContext = wrapper.Content = content;

            parent.Children.Add(wrapper); // Need to do this before calling ApplyTemplate
            if (!reuse)
            {
                wrapper.ApplyTemplate();
            }

            return wrapper;
        }
示例#36
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _pagePresentersPanel = (Panel)GetTemplateChild(PagePresentersPanelName);
        }