當前位置: 首頁>>代碼示例>>C#>>正文


C# Controls.Panel類代碼示例

本文整理匯總了C#中Windows.UI.Xaml.Controls.Panel的典型用法代碼示例。如果您正苦於以下問題:C# Panel類的具體用法?C# Panel怎麽用?C# Panel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Panel類屬於Windows.UI.Xaml.Controls命名空間,在下文中一共展示了Panel類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ShowAttachedFlyoutAtPointer

        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);
        }
開發者ID:haroldma,項目名稱:Audiotica,代碼行數:31,代碼來源:FlyoutEx.cs

示例2: OnApplyTemplate

        /// <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();
        }
開發者ID:tupunco,項目名稱:Tup.WinRTControls,代碼行數:32,代碼來源:ColorPicker.cs

示例3: AttachToPage

 /// <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);
 }
開發者ID:JoergNeumann,項目名稱:HelpFrame,代碼行數:11,代碼來源:HelpLayer.cs

示例4: OnApplyTemplate

        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();
        }
開發者ID:ridomin,項目名稱:waslibs,代碼行數:26,代碼來源:Carousel.cs

示例5: Initialize

        public static void Initialize(Panel panel)
        {
            InitializeOutputWindow();
            IniitalizeScrollViewer();

            panel.Children.Add(ScrollViewer);

            IsInitialized = true;
        }
開發者ID:ch0p57ickz,項目名稱:SunfounderWin10IoT,代碼行數:9,代碼來源:OutputInitializer.cs

示例6: MediaElementContainer

            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");
            }
開發者ID:oldnewthing,項目名稱:old-Windows8-samples,代碼行數:11,代碼來源:Scenario3.xaml.cs

示例7: VisualElementPackager

		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");
		}
開發者ID:cosullivan,項目名稱:Xamarin.Forms,代碼行數:11,代碼來源:VisualElementPackager.cs

示例8: OnApplyTemplate

        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)); }
        }
開發者ID:jessejjohnson,項目名稱:iot-devices,代碼行數:11,代碼來源:GraphicsDisplayPanel.cs

示例9: SequencePage

        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();
        }
開發者ID:Chrislaos,項目名稱:MetroSocket2,代碼行數:12,代碼來源:SequencePage.xaml.cs

示例10: MonitorControl

        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);
        }
開發者ID:selaromdotnet,項目名稱:Coding4FunToolkit,代碼行數:12,代碼來源:MovementMonitor.cs

示例11: AddWebViewWithBinding

 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);
         }
     }
 }
開發者ID:Autumn05,項目名稱:UWP_ZhiHuRiBao,代碼行數:13,代碼來源:WebViewUtil.cs

示例12: OnApplyTemplate

 /// <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();
 }
開發者ID:SuperMap,項目名稱:iClient-for-Win8,代碼行數:15,代碼來源:SliderElement.cs

示例13: AttachedProgress

        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);
        }
開發者ID:garicchi,項目名稱:Neuronia,代碼行數:16,代碼來源:AttachedProgress.cs

示例14: OnApplyTemplate

        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();
        }
開發者ID:ridomin,項目名稱:waslibs,代碼行數:47,代碼來源:ShellControl.cs

示例15: OnApplyTemplate

        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();
        }
開發者ID:ridomin,項目名稱:waslibs,代碼行數:46,代碼來源:Pivorama.cs


注:本文中的Windows.UI.Xaml.Controls.Panel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。