父亲的战争片尾曲,快乐大本营2010925,俄罗斯举重队禁赛
<window x:class="testofcontentcontrol.mainwindow"
xmlns=""
xmlns:x=""
title="mainwindow" height="350" width="525">
<stackpanel>
<button margin="5" >
<textblock text="hello" />
</button>
<button margin="5" >
<image source="j.png" width="30" height="30" />
</button>
<groupbox margin="10" borderbrush="gray" >
<groupbox.header>
<image source="j.png" width="20" height="20" />
</groupbox.header>
<textblock textwrapping="wrapwithoverflow" margin="5"
text="一棵树,一匹马,一头大象和一只鸡在一起,打一种日常用品。"/>
</groupbox>
</stackpanel>
</window>
<window x:class="testofcontentcontrol.mainwindow"
xmlns=""
xmlns:x=""
title="mainwindow" height="350" width="525">
<stackpanel>
<button margin="5" >
<textblock text="hello" />
</button>
<button margin="5" >
<image source="j.png" width="30" height="30" />
</button>
<groupbox margin="10" borderbrush="gray" >
<groupbox.header>
<image source="j.png" width="20" height="20" />
</groupbox.header>
<textblock textwrapping="wrapwithoverflow" margin="5"
text="一棵树,一匹马,一头大象和一只鸡在一起,打一种日常用品。"/>
</groupbox>
</stackpanel>
</window>
[html] view plaincopyprint?
<window x:class="testofitemscontrol.mainwindow"
xmlns=""
xmlns:x=""
title="mainwindow" height="350" width="525">
<stackpanel>
<listbox margin="5" >
<checkbox x:name="checkboxtim" content="tim" />
<checkbox x:name="checkboxtom" content="tom" />
<checkbox x:name="checkboxbruce" content="bruce" />
<button x:name="buttonmess" content="mess" />
<button x:name="buttonowen" content="owen" />
<button x:name="buttonvictor" content="victor" click="buttonvictor_click"/>
</listbox>
<listbox x:name="emplists" >
</listbox>
</stackpanel>
</window>
<window x:class="testofitemscontrol.mainwindow"
xmlns=""
xmlns:x=""
title="mainwindow" height="350" width="525">
<stackpanel>
<listbox margin="5" >
<checkbox x:name="checkboxtim" content="tim" />
<checkbox x:name="checkboxtom" content="tom" />
<checkbox x:name="checkboxbruce" content="bruce" />
<button x:name="buttonmess" content="mess" />
<button x:name="buttonowen" content="owen" />
<button x:name="buttonvictor" content="victor" click="buttonvictor_click"/>
</listbox>
<listbox x:name="emplists" >
</listbox>
</stackpanel>
</window>
[csharp] view plaincopyprint?
using system;
using system.collections.generic;
using system.linq;
using system.text;
using system.windows;
using system.windows.controls;
using system.windows.data;
using system.windows.documents;
using system.windows.input;
using system.windows.media;
using system.windows.media.imaging;
using system.windows.navigation;
using system.windows.shapes;
namespace testofitemscontrol
{
/// <summary>
/// interaction logic for mainwindow.xaml
/// </summary>
public partial class mainwindow : window
{
public mainwindow()
{
initializecomponent();
}
private void buttonvictor_click(object sender, routedeventargs e)
{
list<employee> emplist = new list<employee>()
{
new employee(){id=1,name="tim",age = 30},
new employee(){id=2,name="tom",age=26},
new employee(){id=3,name="guo",age=26},
new employee(){id=4,name="yan",age=26},
new employee(){id=5,name="owen",age=26},
new employee(){id=6,name="victor",age=26}
};
button btn = sender as button;
dependencyobject level1 = visualtreehelper.getparent(btn);
dependencyobject level2 = visualtreehelper.getparent(level1);
dependencyobject level3 = visualtreehelper.getparent(level2);
messagebox.show(level3.gettype().tostring());
this.emplists.displaymemberpath = "name";
this.emplists.selectedvaluepath = "id";
this.emplists.itemssource = emplist;
}
}
public class employee
{
public int id { get; set; }
public string name { get; set; }
public int age { get; set; }
}
}
using system;
using system.collections.generic;
using system.linq;
using system.text;
using system.windows;
using system.windows.controls;
using system.windows.data;
using system.windows.documents;
using system.windows.input;
using system.windows.media;
using system.windows.media.imaging;
using system.windows.navigation;
using system.windows.shapes;
namespace testofitemscontrol
{
/// <summary>
/// interaction logic for mainwindow.xaml
/// </summary>
public partial class mainwindow : window
{
public mainwindow()
{
initializecomponent();
}
private void buttonvictor_click(object sender, routedeventargs e)
{
list<employee> emplist = new list<employee>()
{
new employee(){id=1,name="tim",age = 30},
new employee(){id=2,name="tom",age=26},
new employee(){id=3,name="guo",age=26},
new employee(){id=4,name="yan",age=26},
new employee(){id=5,name="owen",age=26},
new employee(){id=6,name="victor",age=26}
};
button btn = sender as button;
dependencyobject level1 = visualtreehelper.getparent(btn);
dependencyobject level2 = visualtreehelper.getparent(level1);
dependencyobject level3 = visualtreehelper.getparent(level2);
messagebox.show(level3.gettype().tostring());
this.emplists.displaymemberpath = "name";
this.emplists.selectedvaluepath = "id";
this.emplists.itemssource = emplist;
}
}
public class employee
{
public int id { get; set; }
public string name { get; set; }
public int age { get; set; }
}
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
asp.net搭建博客,使用BlogEngine.NET+MySql搭建博客
网友评论