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


C# Controls.ContentControl類代碼示例

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


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

示例1: OnApplyTemplate

        protected override void OnApplyTemplate() {
            base.OnApplyTemplate();
            ContentPresenter = (ContentControl)GetTemplateChild("ContentPresenter");
            planeProjection = (PlaneProjection)GetTemplateChild("Rotator");
            LayoutRoot = (FrameworkElement)GetTemplateChild("LayoutRoot");

            Animation = (Storyboard)GetTemplateChild("Animation");
            Animation.Completed += Animation_Completed;

            rotationKeyFrame = (EasingDoubleKeyFrame)GetTemplateChild("rotationKeyFrame");
            offestZKeyFrame = (EasingDoubleKeyFrame)GetTemplateChild("offestZKeyFrame");
            scaleXKeyFrame = (EasingDoubleKeyFrame)GetTemplateChild("scaleXKeyFrame");
            scaleYKeyFrame = (EasingDoubleKeyFrame)GetTemplateChild("scaleYKeyFrame");
            scaleTransform = (ScaleTransform)GetTemplateChild("scaleTransform");

            planeProjection.RotationY = yRotation;
            planeProjection.LocalOffsetZ = zOffset;

            if (ContentPresenter != null) {
                ContentPresenter.Tapped += ContentPresenter_Tapped;
            }

            if (Animation != null) {
                xAnimation = new DoubleAnimation();
                Animation.Children.Add(xAnimation);
                Storyboard.SetTarget(xAnimation, this);
                Storyboard.SetTargetProperty(xAnimation, "(Canvas.Left)");
            }
        }
開發者ID:ronlemire2,項目名稱:UWP-Apps,代碼行數:29,代碼來源:CoverFlowItem.cs

示例2: UpdateItemDetails

		public void UpdateItemDetails()
		{
			if (DataGrid.ItemDetailsTemplate != null)
			{
				if (!isSelected || !DataGrid.ShowItemDetails)
				{
					if (detailsControl != null)
					{
						Children.Remove(detailsControl);
						detailsControl = null;
					}
				}
				else if (isSelected && DataGrid.ShowItemDetails)
				{
					if (detailsControl == null)
					{
						detailsControl = new ContentControl();
						detailsControl.Content = Item;
						detailsControl.ContentTemplate = DataGrid.ItemDetailsTemplate;
						detailsControl.VerticalContentAlignment = VerticalAlignment.Stretch;
						detailsControl.HorizontalContentAlignment = HorizontalAlignment.Stretch;

						Children.Add(detailsControl);
						SetRow(detailsControl, 1);
						SetColumnSpan(detailsControl, ColumnDefinitions.Count);
					}
					else
						detailsControl.ContentTemplate = DataGrid.ItemDetailsTemplate;
				}
			}

			foreach (var cell in Cells)
				cell.OnSelectedChanged(isSelected);
		}
開發者ID:fstn,項目名稱:WindowsPhoneApps,代碼行數:34,代碼來源:DataGridRow.cs

示例3: AdapterAssociatesSelectorWithRegionActiveViews

        public async Task AdapterAssociatesSelectorWithRegionActiveViews()
        {
            await ExecuteOnUIThread(() =>
                {
                    var control = new ContentControl();
                    IRegionAdapter adapter = new TestableContentControlRegionAdapter();

                    MockPresentationRegion region = (MockPresentationRegion)adapter.Initialize(control, "Region1");
                    Assert.IsNotNull(region);

                    Assert.IsNull(control.Content);
                    region.MockActiveViews.Items.Add(new object());

                    Assert.IsNotNull(control.Content);
                    Assert.AreSame(control.Content, region.ActiveViews.ElementAt(0));

                    region.MockActiveViews.Items.Add(new object());
                    Assert.AreSame(control.Content, region.ActiveViews.ElementAt(0));

                    region.MockActiveViews.Items.RemoveAt(0);
                    Assert.AreSame(control.Content, region.ActiveViews.ElementAt(0));

                    region.MockActiveViews.Items.RemoveAt(0);
                    Assert.IsNull(control.Content);
                });
        }
開發者ID:xperiandri,項目名稱:PortablePrism,代碼行數:26,代碼來源:ContentControlRegionAdapterFixture.cs

示例4: InitializeComponent

        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-resource://wikipediaquerytoolxaml/Files/SplitPage.xaml"));

            CollectionViewSource = (Windows.UI.Xaml.Data.CollectionViewSource)this.FindName("CollectionViewSource");
            LayoutRoot = (Windows.UI.Xaml.Controls.Grid)this.FindName("LayoutRoot");
            OrientationStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("OrientationStates");
            Full = (Windows.UI.Xaml.VisualState)this.FindName("Full");
            Fill = (Windows.UI.Xaml.VisualState)this.FindName("Fill");
            Portrait = (Windows.UI.Xaml.VisualState)this.FindName("Portrait");
            PortraitDetail = (Windows.UI.Xaml.VisualState)this.FindName("PortraitDetail");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
            SnappedDetail = (Windows.UI.Xaml.VisualState)this.FindName("SnappedDetail");
            PrimaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("PrimaryColumn");
            TitlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("TitlePanel");
            ItemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("ItemListView");
            ItemDetail = (Windows.UI.Xaml.Controls.ContentControl)this.FindName("ItemDetail");
            ItemStackPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("ItemStackPanel");
            BackButton = (Windows.UI.Xaml.Controls.Button)this.FindName("BackButton");
            PageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PageTitle");
        }
開發者ID:danshultz11,項目名稱:NetflixBrowserXaml,代碼行數:25,代碼來源:SplitPage.g.i.cs

示例5: GetMessageDialog

        /// <summary>
        /// Returns the child window to display as part of the trigger action.
        /// </summary>
        /// <param name="notification">The notification to display in the child window.</param>
        /// <returns></returns>
        protected override MessageDialog GetMessageDialog(INotification notification)
        {
            var childWindow = this.MessageDialog ?? this.CreateDefaultWindow(notification);
            var contentControl = new ContentControl();
            childWindow.DataContext = notification;

            return childWindow;
        }
開發者ID:xperiandri,項目名稱:PortablePrism,代碼行數:13,代碼來源:PopupMessageDialogAction.cs

示例6: Start

        public static void Start(ContentControl f12panel) {
            if (F12toolsInstance == null) F12toolsInstance = new F12Tools(f12panel);


            F12toolsInstance.F12Panel.Content = new ConsoleUI();
            F12toolsInstance.F12Panel.Visibility = Windows.UI.Xaml.Visibility.Visible;

            IsStarted = true;
        }
開發者ID:liquidboy,項目名稱:X,代碼行數:9,代碼來源:F12Service.cs

示例7: Init

        public void Init(ContentControl contentFrame1, ContentControl contentFrame2)
        {

            _contentFrame1 = contentFrame1;
            _contentFrame2 = contentFrame2;
            
            _contentFrame1.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            _contentFrame2.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
        }
開發者ID:liquidboy,項目名稱:X,代碼行數:9,代碼來源:NavigationServiceBase.cs

示例8: OnApplyTemplate

		public void OnApplyTemplate()
		{
			base.OnApplyTemplate();
			this.WatermarkContent = this.GetTemplateChild("watermarkContent") as ContentControl;
			if (WatermarkContent != null)
			{
				DetermineWatermarkContentVisibility();
			}
		}
開發者ID:Korshunoved,項目名稱:Win10reader,代碼行數:9,代碼來源:WatermarkedTextBox.cs

示例9: OnApplyTemplate

        protected override void OnApplyTemplate()
        {
            _rootGrid = GetTemplateChild(PART_ROOT_NAME) as Grid;
            _grabberGrid = GetTemplateChild(PART_GRABBER_NAME) as Grid;
            _contentPresenter = GetTemplateChild(PART_CONTENT_NAME) as ContentControl;
            _thumb = GetTemplateChild(PART_THUMB_NAME) as Thumb;

            InitEvents();
        }
開發者ID:crazycreak,項目名稱:Template10,代碼行數:9,代碼來源:Resizer.cs

示例10: AddEnemy

 private void AddEnemy()
 {
     ContentControl enemy = new ContentControl();
     enemy.Template = Resources["EnemyTemplate"] as ControlTemplate;
     AnimateEnemy(enemy, 0, playArea.ActualWidth - 100, "(Canvas.Left)");
     AnimateEnemy(enemy, random.Next((int)playArea.ActualHeight - 100),
         random.Next((int)playArea.ActualHeight - 100), "(Canvas.Top)");
     playArea.Children.Add(enemy);
 }
開發者ID:HeberAlvarez,項目名稱:HeadFirst,代碼行數:9,代碼來源:MainPage.xaml.cs

示例11: GenerateElement

		public override DataGridCell GenerateElement(object dataItem)
		{
			var control = new ContentControl();
			control.HorizontalContentAlignment = HorizontalAlignment.Stretch;
			control.VerticalContentAlignment = VerticalAlignment.Stretch;
			control.Content = dataItem;
			control.ContentTemplate = cellTemplate;

			if (OnlyVisibleOnSelection)
				control.Visibility = IsSelected ? Visibility.Visible : Visibility.Collapsed; 
			return new DataGridTemplatedCell(control, OnlyVisibleOnSelection);
		}
開發者ID:fstn,項目名稱:WindowsPhoneApps,代碼行數:12,代碼來源:DataGridTemplatedColumn.cs

示例12: ControlWithExistingContentThrows

        public async Task ControlWithExistingContentThrows()
        {
            await ExecuteOnUIThread(() =>
                {
                    var control = new ContentControl() { Content = new object() };

                    IRegionAdapter adapter = new TestableContentControlRegionAdapter();

                    Assert.ThrowsException<InvalidOperationException>(
                        () => (MockPresentationRegion)adapter.Initialize(control, "Region1"),
                        "ContentControl's Content property is not empty.");
                });
        }
開發者ID:xperiandri,項目名稱:PortablePrism,代碼行數:13,代碼來源:ContentControlRegionAdapterFixture.cs

示例13: AnimateEnemy

 private void AnimateEnemy(ContentControl enemy, double from, double to, string propertyToAnimate)
 {
     Storyboard storyboard = new Storyboard() { AutoReverse = true, RepeatBehavior = RepeatBehavior.Forever };
     DoubleAnimation animation = new DoubleAnimation()
     {
         From = from,
         To = to,
         Duration = new Duration(TimeSpan.FromSeconds(random.Next(4, 6)))
     };
     Storyboard.SetTarget(animation, enemy);
     Storyboard.SetTargetProperty(animation, propertyToAnimate);
     storyboard.Children.Add(animation);
     storyboard.Begin();
 }
開發者ID:HeberAlvarez,項目名稱:HeadFirst,代碼行數:14,代碼來源:MainPage.xaml.cs

示例14: GoToStateCore

        protected override bool GoToStateCore(Control control, FrameworkElement stateGroupsRoot, string stateName, VisualStateGroup group, VisualState state, bool useTransitions)
        {
            if ((group == null) || (state == null))
            {
                return false;
            }

            if (control == null)
            {
                control = new ContentControl();
            }

            return base.GoToStateCore(control, stateGroupsRoot, stateName, group, state, useTransitions);
        }
開發者ID:smndtrl,項目名稱:Signal-UWP,代碼行數:14,代碼來源:ExtendedVisualStateManager.cs

示例15: 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


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