• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Controls.ContentControl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Windows.UI.Xaml.Controls.ContentControl的典型用法代码示例。如果您正苦于以下问题:C# ContentControl类的具体用法?C# ContentControl怎么用?C# ContentControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ContentControl类属于Windows.UI.Xaml.Controls命名空间,在下文中一共展示了ContentControl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: FullWindowPopup

        public FullWindowPopup()
        {
            _contentControl = new ContentControl()
            {
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                VerticalContentAlignment = VerticalAlignment.Stretch
            };

            _popup = new Popup()
            {
                Child = _contentControl
            };
            var binding = new Binding()
            {
                Source = this,
                Path = new PropertyPath(nameof(IsOpen)),
                Mode = BindingMode.TwoWay
            };
            _popup.SetBinding(Popup.IsOpenProperty, binding);

            Action keepPopupSize = () =>
            {
                Window.Current.SizeChanged += delegate
                {
                    ReSize();
                };
                ReSize();
            };

            var app = Bootstrapper.Current;
            if (app != null && app.IsInConstructing)
            {
                // 应用程序的 App 类继承自 Bootstrapper,并且当前处于 App 类的构造函数中,将保持 Popup 大小的方法放至构造函数执行完成后再执行。
                app._waitForConstructedActions.Add(() =>
                {
                    keepPopupSize.Invoke();
                    return Task.FromResult<object>(null);
                });
            }
            else
            {
                keepPopupSize.Invoke();
            }
        }
开发者ID:h82258652,项目名称:SoftwareKobo.UniversalToolkit,代码行数:44,代码来源:FullWindowPopup.cs


示例17: ControlWithExistingBindingOnContentWithNullValueThrows

        public async Task ControlWithExistingBindingOnContentWithNullValueThrows()
        {
            await ExecuteOnUIThread(() =>
                {
                    var control = new ContentControl();
                    Binding binding = new Binding
                    {
                        Path = new PropertyPath("ObjectContents"),
                        Source = new SimpleModel() { ObjectContents = null }
                    };
                    control.SetBinding(ContentControl.ContentProperty, binding);

                    IRegionAdapter adapter = new TestableContentControlRegionAdapter();

                    Assert.ThrowsException<InvalidOperationException>(
                        () => (MockPresentationRegion)adapter.Initialize(control, "Region1"),
                        "ContentControl's Content property is not empty.");
                });
        }
开发者ID:xperiandri,项目名称:PortablePrism,代码行数:19,代码来源:ContentControlRegionAdapterFixture.cs


示例18: OnApplyTemplate

        protected override void OnApplyTemplate()
        {
            var rootLayout = (FrameworkElement)GetTemplateChild("RootLayout");

            // 实际内容容器。
            _contentBorder = (ContentControl)GetTemplateChild("ContentBorder");

            // 倒影图片。
            _reflectionImage = (Image)GetTemplateChild("ReflectionImage");

            // 倒影位移。
            _spacingTransform = (TranslateTransform)GetTemplateChild("SpacingTransform");
            _spacingTransform.Y = ReflectionSpacing;

            if (DesignMode.DesignModeEnabled == false)
            {
                rootLayout.LayoutUpdated += RootLayoutChanged;
            }
        }
开发者ID:h82258652,项目名称:SoftwareKobo.UniversalToolkit,代码行数:19,代码来源:ReflectionPanel.cs


示例19: OnApplyTemplate

        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            firstContentPresenter = GetTemplateChild("FirstContentPresenter") as ContentControl;
            if (firstContentPresenter != null)
                appFrame = firstContentPresenter.Content as Frame;

            loadMenuAndBar(true);
            appFrame.Navigated += (sender, e) => loadMenuAndBar();

            topBar = GetTemplateChild("TopBar") as ContentControl;
            topBarGrid = GetTemplateChild("TopBarGrid") as Grid;
            menu = GetTemplateChild("Menu") as ContentControl;

            menuButton = GetTemplateChild("MenuButton") as Border;
            menuButton.Tapped += (sender, e) =>
            {
                if (isMenuOpened)
                    CloseMenu();
                else
                    OpenMenu();
            };

            mainGrid = GetTemplateChild("MainGrid") as Grid;

            var view = ApplicationView.GetForCurrentView();
            if (view != null && view.DesiredBoundsMode != ApplicationViewBoundsMode.UseCoreWindow)
                view.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);

            var statusBar = StatusBar.GetForCurrentView();
            if (statusBar != null)
            {
                statusBar.BackgroundColor = new Color() { R = 0, G = 0, B = 0 };
                statusBar.ForegroundColor = new Color() { R = 255, G = 255, B = 255 };
                statusBar.BackgroundOpacity = 0;
            }

            gestureHandler();

            DisplayInformation.GetForCurrentView().OrientationChanged += FrameContainer_OrientationChanged;
        }
开发者ID:ViktorMeduneckij,项目名称:CoinFlip-WP8.1-,代码行数:42,代码来源:FrameContainer.cs


示例20: OnApplyTemplate

        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _content = GetTemplateChild(ContentName) as Grid;
            _pane = GetTemplateChild(PaneName) as ContentControl;
            _menuIcon = GetTemplateChild(MenuIconName) as TextBlock;
            _hidePane = GetTemplateChild(HidePaneName) as Storyboard;
            _showPane = GetTemplateChild(ShowPaneName) as Storyboard;
            _hidePaneAnimation = GetTemplateChild(HidePaneAnimationName) as DoubleAnimation;
            _showPaneAnimation = GetTemplateChild(ShowPaneAnimationName) as DoubleAnimation;
            _showPaneContentAnimation = GetTemplateChild(ShowPaneContentAnimationName) as DoubleAnimation;

            this.Unloaded += SplitView_Unloaded;
            _pane.SizeChanged += leftPane_SizeChanged;
            _menuIcon.Tapped += _menuIcon_Tapped;
            
            ManipulationMode = ManipulationModes.TranslateX;
            ManipulationDelta += SplitView_ManipulationDelta;
            ManipulationCompleted += SplitView_ManipulationCompleted;
        }
开发者ID:fubar-coder,项目名称:bifrost.xaml,代码行数:21,代码来源:SplitView.cs



注:本文中的Windows.UI.Xaml.Controls.ContentControl类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Controls.Frame类代码示例发布时间:2022-05-26
下一篇:
C# Controls.Canvas类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap