小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

silverlight教程(4)---使用風(fēng)格元素,以更好地概括外觀與感覺

 莣ヤㄋ莪 2009-05-07
 wpf和silverlight支持一種風(fēng)格機制,使我們能夠控制拮據(jù)的財產(chǎn)價值作為一個可重復(fù)使用的資源,我們可以存儲這些風(fēng)格報關(guān)單單獨文件從網(wǎng)頁,并重新使用它們橫跨多個控制和網(wǎng)頁應(yīng)用程序(以及再利用他們跨多個應(yīng)用程序) ,這是在概念上類似于使用CSS與HTML的時候,做基礎(chǔ)定制的情況。

Note: In addition to defining basic property settings (Color, Font, Size, Margins, etc), styles in WPF and Silverlight can also be used to define and re-use Control Templates - which enable super rich skinning and adaptation of control structure (and support customization scenarios not possible with CSS in HTML today).  I discuss Control Templates in Part 7 of this series. 注:除界定基本屬性的設(shè)置(顏色,字體,大小,利潤率等) ,風(fēng)格wpf和silverlight也可以被用來界定和再利用控制模板-使超級富豪的s kinning功能和適應(yīng)的控制結(jié)構(gòu)(并支持個性化的情況,不可能同的CSS在HTML今日) ,討論控制模板,在第7部的這一系列。

For our Digg sample application we'll define our Style declarations within the App.xaml file of our project.  This will enable them to be reused across all pages and controls in the application:我們digg采樣應(yīng)用,我們將確定我們的作風(fēng)報關(guān)單內(nèi)app.xaml檔案,我們的項目,這將使他們能夠重復(fù)使用,所有的頁面和控制中的應(yīng)用:

Let's start by encapsulating styles for the <Border> control (and the <TextBlock> title contained within it) of our Digg page:讓我們先灌封作風(fēng),為<border>控制(以及<textblock>標(biāo)題中包含它)我國Digg頁面:

We can create two Style elements within our App.xaml file that encapsulate the <Border> and <TextBlock> settings we were previously declaring inline using the markup below:我們可以制造兩個風(fēng)格分子,我們app.xaml文件,概括了<border>和<textblock>設(shè)置我們以前曾經(jīng)申報直列用標(biāo)記如下:

Note how we are giving each Style a unique "Key" value above.  We can then update our <Border> and <TextBlock> controls to reference the Styles using these keys.  We'll be using a XAML feature called "markup extensions" to do this.  Markup extensions are used when there are non-literal values that we want to set (another example of where we'll use this feature is with databinding expressions).說明我們?nèi)绾巫屆恳粋€風(fēng)格獨特的"鑰匙"的價值以上,我們便可以更新我們的<border>和<textblock>管制,以提述方式使用這些鑰匙,我們都會用xaml功能叫做"標(biāo)記延伸"做到這一點。標(biāo)記延用的時候,是有非字面的價值觀,我們要設(shè)置(另一個例子,我們將在使用此功能是和數(shù)據(jù)綁定表達(dá)式) 。

When we update the other controls within our Page.xaml file to use styles as well, we are left with a file that looks like below:當(dāng)我們更新其他管制措施,我們page.xaml檔案使用作風(fēng)好,我們只剩下一個文件看起來像下面:

Encapsulate the style settings this way allows developers to better focus on the behavior semantics of the application, and also enables us to re-use styles across other controls/pages we build.概括了樣式設(shè)置這種方式允許開發(fā),以更好地著眼于行為語義學(xué)的應(yīng)用,也使我們得以重新使用風(fēng)格跨越其他管制/頁,我們建立的。

Note: One issue to be aware of with Beta1 is that the error message when you mistype style names and property declarations is not very clear (it raises an exception but doesn't tell you what isn't set correctly).  This will be improved in Beta2. 注:一個問題,他們必須明白,與素beta1是錯誤的訊息,當(dāng)你錯誤的作風(fēng)姓名及財產(chǎn)申報不很清楚(它提出了一個例外,但并沒有告訴你什么是不正確設(shè)置) ,這將得到改善在間諜軟件。 In the meantime if you see an error loading a style make sure to look carefully for typos. 在此期間,如果你看到一個錯誤裝載的風(fēng)格一定要仔細(xì)看看,為錯別字。

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多