本文整理汇总了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)");
}
}
示例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);
}
示例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);
});
}
示例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");
}
示例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;
}
示例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;
}
示例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;
}
示例8: OnApplyTemplate
public void OnApplyTemplate()
{
base.OnApplyTemplate();
this.WatermarkContent = this.GetTemplateChild("watermarkContent") as ContentControl;
if (WatermarkContent != null)
{
DetermineWatermarkContentVisibility();
}
}
示例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();
}
示例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);
}
示例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);
}
示例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.");
});
}
示例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();
}
示例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);
}
示例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();
}