本文整理汇总了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);
}
}
示例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 ();
}
示例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");
}
示例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;
}