All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
浅谈同页面用多个id_[Html教程]
PHP将将,XML,映射为,HTML的代码实例_php资料_编程技术
怎样才能成为PHP高手学会懒惰的编程_[PHP教程]
SQL SERVER 2005 EXPRESS不能远程连接的问题_[SQL Server教程]
PHP生成随机字符串_[PHP教程]
VS2008简体中文版下载(及升级为正式版办法,见截图)_[Asp.Net教程]
二十一 Forms 可用性_[Html教程]
ASP.NET,2.0中GridView无限层复杂表头的实现_[Asp.Net教程]
RSS制作
实例详细讲解PHP连接调用数据库的方法_php资料_编程技术
Reading number is top 10 pictures
这是男生笨么?
The real super beauty13
The real super beauty9
Small s breast enhancement demonstration
全球十大灵异酒店
The little woman's bright wire3
这才是真正的人体艺术5
修电脑也有这么漂亮的美女
PengLiYuan lady for the world health organization fight TB and AIDS goodwill ambassador
人造器官和铁肺人
Download software ranking
Tram sex maniac 2 (H) rar bag9
apache-tomcat-6.0.33
变速齿轮3.26
Desire a peach blossom
在线棋牌游戏3.05版
Unix video tutorial18
White deer villiage
DreamWeaver8
Tram sex maniac 2 (H) rar bag14
网络管理员第三版
aaa published in(发表于) 2013/12/15 8:52:04 Edit(编辑)
关于C#代码实现ControlTemplate_.net资料_编程技术

关于C#代码实现ControlTemplate_.net资料_编程技术

关于C#代码实现ControlTemplate_.net资料_编程技术-你的首页-uuhomepage.com

  现在主流的控件模板和样式是引用XAML资源,不过感觉没有c#代码实现那么灵活,现介绍一下代码实现 ControlTemplate的方法:


//控件呈现的显示内容1(这里为Image)
FrameworkElementFactory fe = new FrameworkElementFactory(typeof(Image), "Image");

BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.UriSource = new Uri(@"E:ChartControlHanYangChartControlImageMainBackground.jpg");
bi.EndInit();

fe.SetValue(Image.SourceProperty, bi);

//控件呈现的显示内容2(这里为TextBox)
FrameworkElementFactory fe2 = new FrameworkElementFactory(typeof(TextBox), "TextBox");
fe2.SetValue(TextBox.WidthProperty,100.0);
fe2.SetValue(TextBox.HeightProperty, 100.0);

//把要呈现的显示内容封装起来
FrameworkElementFactory f = new FrameworkElementFactory(typeof(Grid), "Grid");
f.AppendChild(fe);
f.AppendChild(fe2);

//控件模板
ControlTemplate ct = new ControlTemplate(typeof(Button));
ct.VisualTree = f;

//修改Button 的Template
Button btn = new Button();
btn.Template = ct;



添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.