内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

XamarinXAML語言中如何實現(xiàn)模板視圖TemplatedView-創(chuàng)新互聯(lián)

這篇文章給大家分享的是有關(guān)Xamarin XAML語言中如何實現(xiàn)模板視圖TemplatedView的內(nèi)容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。

創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),皇姑企業(yè)網(wǎng)站建設(shè),皇姑品牌網(wǎng)站建設(shè),網(wǎng)站定制,皇姑網(wǎng)站建設(shè)報價,網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,皇姑網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力。可充分滿足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學習、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。

模板視圖TemplatedView

與模板頁面相對的是TemplatedView,它被稱為模板視圖,它的功能和模板頁面類似,也是用來顯示控件模板的,只不過比模板頁面更加靈活。TemplatedView提供ControlTemplate屬性,實現(xiàn)對控件模板的關(guān)聯(lián),從而展現(xiàn)對應的界面。

【示例14-6:TemplatedViewDemo】以下將使用模板視圖顯示控件模板,并實現(xiàn)模板的切換。具體的操作步驟如下:

(1)打開App.xaml文件,編寫代碼,實現(xiàn)在應用程序級別中構(gòu)建控件模板,代碼如下:

  • <?xml version="1.0" encoding="utf-8" ?>

  • <Application xmlns="/tupian/20230522/xamarin

  •              xmlns:x="/tupian/20230522/error.aspx

  •              x:Class="TemplatedViewDemo.App">

  •   <Application.Resources>

  • <ResourceDictionary>

  • <!--構(gòu)建控件模板-->

  •       <ControlTemplate x:Key="ChineseTemplate">

  •         <StackLayout>

  •           <StackLayout VerticalOptions="End">

  •             <BoxView Color="Aqua" />

  •           </StackLayout>

  •           <StackLayout Spacing="35"

  •             VerticalOptions="CenterAndExpand"  >

  •             <Frame OutlineColor="Accent">

  •               <StackLayout Spacing="20"

  •                            VerticalOptions="CenterAndExpand"

  •                            HorizontalOptions="Center">

  •                 <Label Text="山居秋暝"

  •                        FontSize="30"

  •                        FontAttributes="Bold"

  •                        HorizontalOptions="Center"/>

  •                 <Label Text="空山新雨后,天氣晚來秋。"

  •                        FontSize="18"/>

  •                 <Label Text="明月松間照,清泉石上流。"

  •                        FontSize="18"/>

  •                 <Label Text="竹喧歸浣女,蓮動下漁舟。"

  •                        FontSize="18"/>

  •                 <Label Text="隨意春芳歇,王孫自可留。"

  •                        FontSize="18"/>

  •               </StackLayout>

  •             </Frame>

  •             <Button Command="{TemplateBinding Parent. CommandEnglish}"

  •                       Text="Enter English Template" />

  •           </StackLayout>

  •         </StackLayout>

  •       </ControlTemplate>

  • <!--構(gòu)建控件模板-->

  •       <ControlTemplate x:Key="EnglishTemplate">

  •         <StackLayout>

  •           <StackLayout VerticalOptions="End">

  •             <BoxView Color="Green" />

  •           </StackLayout>

  •           <StackLayout Spacing="35"

  •                        VerticalOptions="CenterAndExpand"  >

  •             <Frame OutlineColor="Accent">

  •               <Label Text="your life only lasts for a few decades, so be sure that you don\'t leave any regrets. laugh or cry as you like, and it‘s meaningless to oppress yourself."

  •                      FontAttributes="Bold"

  •                      FontSize="18"/>

  •             </Frame>

  •             <Button Command="{TemplateBinding Parent.CommandChinese}"

  •                     Text="Enter Chinese Template" />

  •           </StackLayout>

  •         </StackLayout>

  •       </ControlTemplate>

  •     </ResourceDictionary>

  •   </Application.Resources>

  • </Application>

在此代碼中,我們構(gòu)建了兩個控件模板,一個為ChineseTemplate控件模板,另一為EnglishTemplate控件模板。

感謝各位的閱讀!關(guān)于“Xamarin XAML語言中如何實現(xiàn)模板視圖TemplatedView”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!

網(wǎng)站標題:XamarinXAML語言中如何實現(xiàn)模板視圖TemplatedView-創(chuàng)新互聯(lián)
網(wǎng)站路徑:http://www.rwnh.cn/article2/dcpeic.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、用戶體驗、網(wǎng)站策劃建站公司、自適應網(wǎng)站、標簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

微信小程序開發(fā)
威远县| 迭部县| 临漳县| 沂水县| 霍邱县| 景德镇市| 沁源县| 和林格尔县| 呼玛县| 南投县| 建始县| 博兴县| 海南省| 清远市| 盐亭县| 芮城县| 宜黄县| 遂川县| 陕西省| 白朗县| 富源县| 孟连| 镇康县| 宣武区| 灵石县| 湘潭县| 聂拉木县| 苍溪县| 荔波县| 曲松县| 上思县| 普兰县| 武强县| 鄯善县| 新余市| 启东市| 广宁县| 资源县| 黄龙县| 德惠市| 怀柔区|