本文整理汇总了C#中Windows.UI.Xaml.FrameworkElement.FindName方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkElement.FindName方法的具体用法?C# FrameworkElement.FindName怎么用?C# FrameworkElement.FindName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.FrameworkElement
的用法示例。
在下文中一共展示了FrameworkElement.FindName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareContent
private void PrepareContent()
{
if (page1 == null)
{
page1 = new PageForPrinting();
StackPanel header = (StackPanel)page1.FindName("header");
header.Visibility = Windows.UI.Xaml.Visibility.Visible;
}
PrintContainer.Children.Add(page1);
PrintContainer.InvalidateMeasure();
PrintContainer.UpdateLayout();
}
示例2: GetLocation
/// <summary>
/// Gets the data context of the specified element as a LocationData instance.
/// </summary>
/// <param name="element">The element bound to the location.</param>
/// <returns>The location bound to the element.</returns>
private LocationData GetLocation(FrameworkElement element) =>
(element.FindName("Presenter") as FrameworkElement).DataContext as LocationData;
示例3: FindCommentSortText
/// <summary>
/// Returns a reference to the sort text block.
/// </summary>
/// <param name="parent"></param>
/// <returns></returns>
private TextBlock FindCommentSortText(FrameworkElement parent = null)
{
// Get if if we don't have it and we can.
if (m_commentSortText == null && parent != null)
{
m_commentSortText = (TextBlock)parent.FindName("ui_commentSortText");
}
return m_commentSortText;
}
示例4: GetTimelineTarget
private static object GetTimelineTarget(Control control, FrameworkElement templateRoot, Timeline timeline)
{
string targetName = Storyboard.GetTargetName(timeline);
if (string.IsNullOrEmpty(targetName))
{
return null;
}
if (control is UserControl)
{
return control.FindName(targetName);
}
return templateRoot.FindName(targetName);
}
示例5: PreparePrintContent
/// <summary>
/// Method that will generate print content for the scenario
/// For scenarios 1-4: it will create the first page from which content will flow
/// Scenario 5 uses a different approach
/// </summary>
/// <param name="page">The page to print</param>
public virtual void PreparePrintContent(Page page)
{
if (firstPage == null)
{
firstPage = page;
StackPanel header = (StackPanel)firstPage.FindName("Header");
header.Visibility = Windows.UI.Xaml.Visibility.Visible;
}
// Add the (newly created) page to the print canvas which is part of the visual tree and force it to go
// through layout so that the linked containers correctly distribute the content inside them.
PrintCanvas.Children.Add(firstPage);
PrintCanvas.InvalidateMeasure();
PrintCanvas.UpdateLayout();
}
示例6: PreparedPrintContent
// 提供打印内容
private void PreparedPrintContent()
{
if (printPage == null)
{
printPage = new ThreadRelated.Print();
StackPanel header = (StackPanel)printPage.FindName("header");
header.Visibility = Visibility.Visible;
}
// 向 printingRoot 添加一个打印内容,以便发送到打印机打印
printingRoot.Children.Add(printPage);
printingRoot.InvalidateMeasure();
printingRoot.UpdateLayout();
}
示例7: OnPaginate
// #4 - user has selected a printer so we know paper size, etc.
private void OnPaginate(object sender, PaginateEventArgs e)
{
PrintTaskOptions printingOptions = e.PrintTaskOptions;
PrintPageDescription pageDescription = printingOptions.GetPageDescription(0);
page1 = new DetailPrinting
{
DataContext = this.Child,
Width = pageDescription.PageSize.Width,
Height = pageDescription.PageSize.Height
};
// Assumes we have this on our printable page
Grid printableArea = (Grid)page1.FindName("printableArea");
// size our grid to the paper dimensions
double marginWidth = Math.Max(
pageDescription.PageSize.Width - pageDescription.ImageableRect.Width,
pageDescription.PageSize.Width * left * 2);
double marginHeight = Math.Max(
pageDescription.PageSize.Height - pageDescription.ImageableRect.Height,
pageDescription.PageSize.Height * top * 2);
printableArea.Width = page1.Width - marginWidth;
printableArea.Height = page1.Height - marginHeight;
// We add the printable page to the visual tree so we can lay it out
printContainer.Children.Add(page1);
printContainer.InvalidateMeasure();
printContainer.UpdateLayout();
// in our (relatively) simple example we only have one page
doc.SetPreviewPageCount(1, PreviewPageCountType.Intermediate);
}