当前位置: 首页>>代码示例>>C#>>正文


C# FrameworkElement.FindName方法代码示例

本文整理汇总了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();
        }
开发者ID:Jxperez,项目名称:31DaysOfWindows8,代码行数:13,代码来源:MainPage.xaml.cs

示例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;
开发者ID:SBArbeit,项目名称:Windows-appsample-trafficapp,代码行数:7,代码来源:MainPage.xaml.cs

示例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;
 }
开发者ID:GeertvanHorrik,项目名称:Baconit,代码行数:14,代码来源:UserProfile.xaml.cs

示例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);
 }
开发者ID:xperiandri,项目名称:Xaml.Interactions,代码行数:13,代码来源:ExtendedVisualStateManager.cs

示例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();
        }
开发者ID:C-C-D-I,项目名称:Windows-universal-samples,代码行数:21,代码来源:PrintHelper.cs

示例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();
        }
开发者ID:JamborYao,项目名称:UwpStart,代码行数:15,代码来源:PrintDemo.xaml.cs

示例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);
        }
开发者ID:noriike,项目名称:xaml-106136,代码行数:35,代码来源:DetailViewModel.cs


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