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


C# Button.ApplyTemplate方法代码示例

本文整理汇总了C#中System.Windows.Controls.Button.ApplyTemplate方法的典型用法代码示例。如果您正苦于以下问题:C# Button.ApplyTemplate方法的具体用法?C# Button.ApplyTemplate怎么用?C# Button.ApplyTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.Button的用法示例。


在下文中一共展示了Button.ApplyTemplate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProdWnd

 public ProdWnd()
 {
     InitializeComponent();
     imglist = new Dictionary<string, string>();
     if (Directory.Exists(ProdNum.baseDir + "\\prodpic" + StringResource.language + "\\" ))
         Directory.CreateDirectory(ProdNum.baseDir + "\\prodpic" + StringResource.language + "\\");
     foreach (string f in Directory.GetFiles(ProdNum.baseDir + "\\prodpic\\" + StringResource.language + "\\", "*.jpg"))
     {
         FileInfo fi = new FileInfo(f);
         string nm = fi.Name.Remove(fi.Name.Length-4,4).Replace(' ','_');
         imglist[nm] = fi.FullName;
         Button n = new Button();
         ControlTemplate ct = this.FindResource("imgBtn") as ControlTemplate;
         n.Template = ct;
         n.Name = "ID"+nm;
         n.Content = nm;
         n.Click += ImageSelected;
         n.ApplyTemplate();
         ImageBrush ib = ct.FindName("ImageFill",n) as ImageBrush;
         
         ib.ImageSource = new BitmapImage(new Uri(fi.FullName));
         this.wrapPanel1.Children.Add(n);
     }
 }
开发者ID:imdmmp,项目名称:kpgweigher,代码行数:24,代码来源:ProdWnd.xaml.cs

示例2: TagTest2

		public void TagTest2 ()
		{
			Button b = new Button ();
			TestPanel.Children.Add (b);
			b.ApplyTemplate ();
			
			Enqueue (() => {
				TestPanel.Tag = b;
				TestPanel.Tag = null;
				Assert.IsTrue (b.Focus (), "#1");
			});
			EnqueueTestComplete ();
		}
开发者ID:dfr0,项目名称:moon,代码行数:13,代码来源:FrameworkElementTest.cs

示例3: ApplyTemplateTest

		public void ApplyTemplateTest ()
		{
			Button b = new Button ();

			Assert.AreEqual (0, VisualTreeHelper.GetChildrenCount (b), "1");

			b.ApplyTemplate ();

			Assert.AreEqual (0, VisualTreeHelper.GetChildrenCount (b), "2");

			TestButton tb = new TestButton ();

			Assert.IsFalse (tb.NameFound, "3");
		}
开发者ID:dfr0,项目名称:moon,代码行数:14,代码来源:ControlTemplateTest.cs

示例4: bucket_click

        private void bucket_click(int nodeid)
        {
            App p = Application.Current as App;
            int last_node = curr_node_index;
            if (nodeid < 1)
            {
                return;
            }
            
            last_btn = IdToButton(last_node);
            curr_btn = IdToButton(nodeid);

            curr_node_index = nodeid;

            if (last_btn is Button)
            {
                last_btn.Template = this.FindResource("WeightBar") as ControlTemplate;
                last_btn.ApplyTemplate();
            }
            if (curr_btn is Button)
            {
                curr_btn.Template = this.FindResource("WeightBarFocus") as ControlTemplate;
                curr_btn.ApplyTemplate();
            }
            ShowStatus("loading");
            //update parameter of the current node to UI.
            lastcall = "UpdateUI";
            return;
            
            
        }
开发者ID:imdmmp,项目名称:kpgweigher,代码行数:31,代码来源:SingleModeWnd.xaml.cs


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