偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

WPF默認(rèn)模板調(diào)用方法簡介

開發(fā) 開發(fā)工具
我們在文章中用一個代碼示例來為大家詳細(xì)介紹了WPF默認(rèn)模板的調(diào)用相關(guān)技巧,方便大家了解,希望通過這篇文章的介紹能充分掌握這一知識。

WPF中具有一些模板,在學(xué)習(xí)的過程中我們需要熟練的掌握這些模板的應(yīng)用。在這里我們先來了解一下WPF默認(rèn)模板調(diào)用的具體方法。#t#

***的模板示例:我們知道每個控件都有自己默認(rèn)的模板,這是MS編寫的,如果我們能夠得到這些模板的XAML代碼,那么它將是學(xué)習(xí)模板的***的示例,

要想獲得某個控件ctrl的默認(rèn)模板,請調(diào)用以下方法:

 

  1. string GetTemplateXamlCode
    (Control ctrl) {  
  2. FrameworkTemplate template
     = ctrl.Template;   
  3. string xaml = "";   
  4. if (template != null) {   
  5. XmlWriterSettings settings =
     
    new XmlWriterSettings();  
  6. settings.Indent = true;   
  7. settings.IndentChars = 
    new string(' ', 4);  
  8. settings.NewLineOnAttributes = true;   
  9. StringBuilder strbuild = 
    new StringBuilder();   
  10. XmlWriter xmlwrite = 
    XmlWriter.Create(strbuild, 
    settings); 
  11. try { XamlWriter.Save(template,
     xmlwrite);  
  12. xaml = strbuild.ToString();   
  13. }   
  14. catch (Exception exc)   
  15. xaml = exc.Message;   
  16. }   
  17. }   
  18. else {   
  19. xaml = "no template";   
  20. }   
  21. return xaml;   
  22. }  

 

責(zé)任編輯:曹凱 來源: IT168
相關(guān)推薦

2009-12-23 18:06:25

WPF模板

2009-12-14 16:44:56

Ruby調(diào)用DLL

2010-01-06 17:06:05

Json格式

2010-02-01 10:04:25

Python模板函數(shù)

2009-12-24 14:08:25

WPF數(shù)據(jù)模板

2009-12-25 10:05:06

WPF資源

2009-12-28 15:08:12

WPF字體

2009-12-25 14:35:34

WPF布局

2009-12-24 14:18:57

WPF類型轉(zhuǎn)換

2009-12-28 15:48:14

WPF窗口顏色

2009-12-24 16:36:06

WPF InkCanv

2009-12-28 09:24:58

WPF線程

2010-04-07 15:47:32

Oracle 11g

2009-12-28 10:40:13

WPF調(diào)用Winfor

2009-12-28 17:33:19

WPF視頻音頻

2009-12-28 16:00:36

WPF樣式繼承

2009-12-24 17:57:53

WPF頁面跳轉(zhuǎn)

2009-12-24 18:09:23

WPF開發(fā)環(huán)境

2009-12-28 11:14:29

WPF顯示文本

2009-12-28 13:28:03

WPF視頻
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號