中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

圖片演示dw做網(wǎng)站手機如何創(chuàng)建網(wǎng)站

圖片演示dw做網(wǎng)站,手機如何創(chuàng)建網(wǎng)站,東陽做網(wǎng)站,場所碼小程序怎么做1:控件模版簡介: 自定義控件模版:自己添加的樣式、標(biāo)簽,控件模版也是屬于資源的一種, 每一個控件模版都有一唯一的 key,在控件上通過template屬性進行綁定 什么場景下使用自定義控件模版,當(dāng)項目里面多個地方…

1:控件模版簡介:

自定義控件模版:自己添加的樣式、標(biāo)簽,控件模版也是屬于資源的一種,
? ? ? ? 每一個控件模版都有一唯一的 key,在控件上通過template屬性進行綁定

什么場景下使用自定義控件模版,當(dāng)項目里面多個地方使用到相同效果,這時候可以把相同
? ? ? ? 效果封裝成一個自定義模版,例如項目好幾個地方需要一個弧度并且鼠標(biāo)放上去效果是紅色等按鈕。就可以
? ? ? ? 把按鈕從新自定義一下。

2:關(guān)于控件模版的實例

<Window.Resources><!--自定義模版--><ControlTemplate x:Key="c1" TargetType="Button" ><Border Background="AliceBlue"CornerRadius="5"BorderThickness="2"x:Name="border"><!--ContentPresenter 呈現(xiàn)內(nèi)容的標(biāo)簽--><StackPanel Orientation="Horizontal"><TextBlock VerticalAlignment="Center"Margin="0,0,10,0"Name="t1"Text="☆"></TextBlock><ContentPresenter HorizontalAlignment="Center"VerticalAlignment="Center"></ContentPresenter> </StackPanel></Border><!--Triggers 設(shè)置觸發(fā) 鼠標(biāo)移去 鼠標(biāo)移開等效果--><ControlTemplate.Triggers><!--Property 設(shè)置的屬性Value 屬性值--><!--IsMouseOver 鼠標(biāo)放上去TargetName="border" 目標(biāo)元素的name屬性--><Trigger Property="IsMouseOver"Value="true"><Setter Property="Background"Value="red"TargetName="border"></Setter><Setter Property="BorderBrush"Value="green"TargetName="border"></Setter><Setter Property="Text"Value="★"TargetName="t1"></Setter></Trigger></ControlTemplate.Triggers></ControlTemplate>
</Window.Resources><Grid><!--WPF不僅支持傳統(tǒng)winfrom編程,并且還引入以模版為核心的新一代設(shè)計理念,在wpf通過使用模版將數(shù)據(jù)和界面進行解耦。模版主要分為倆大類型的模版:數(shù)據(jù)模版【DataTemplate】 和控件模版【Control Template】,控件模版:描述如何顯示控件,數(shù)據(jù)模版:描述如何顯示數(shù)據(jù),--><!--<Button Width="100" Height="40" Content="hello world"></Button>--><Button Template="{StaticResource c1}" Width="100" Height="40" Content="刪除" ></Button><Button Template="{StaticResource c1}"Width="100"Height="40"Content="編輯"Margin="0,0,0,100"></Button></Grid>

效果圖如下

?1關(guān)于數(shù)據(jù)模板的簡介:

數(shù)據(jù)模版 DataTemplate:決定了數(shù)據(jù)展示形式和用戶體驗,在控件上通過使用ItemTemplate
? ? ? ? 屬性進行模版的綁定 ?ItemTemplate="{StaticResource c1}

控件模版 ControlTemplate:設(shè)置控件展示,在控件上通過使用Template屬性進行模版綁定
? ? ? ? Template="{StaticResource c1}

2 關(guān)于它的實例

 <Window.Resources><DataTemplate x:Key="c1"><StackPanel Orientation="Horizontal"><Border Width="10" Height="10"Background="{Binding Code}"></Border><TextBlock Text="{Binding Code}"> </TextBlock></StackPanel></DataTemplate></Window.Resources><Grid><ListBox Width="200"Height="100"HorizontalAlignment="Left"VerticalAlignment="Top"ItemTemplate="{StaticResource c1}"Name="l1"></ListBox><ComboBox Width="200"Height="40"ItemTemplate="{StaticResource c1}"Name="com"></ComboBox><!--這是之前的itemsource的寫法--><ListBox Width="200"Height="100"HorizontalAlignment="Left"VerticalAlignment="Top"ItemsSource="{Binding}"Margin="300,0,0,0"Name="l3"><ListBox.ItemTemplate><DataTemplate><StackPanel Orientation="Horizontal"><Border Width="10"Height="10"Background="{Binding Code}"></Border><TextBlock Text="{Binding Code}"></TextBlock></StackPanel></DataTemplate></ListBox.ItemTemplate></ListBox></Grid>

定義模型類

    public Window數(shù)據(jù)模版(){InitializeComponent();List<Color> list = new List<Color>(); //數(shù)據(jù)源集合list.Add(new Color() { Code = "#ff0000"});list.Add(new Color(){Code = "#00ff00"});list.Add(new Color(){Code = "#00FF00"});list.Add(new Color(){Code = "#55efc4"});list.Add(new Color(){Code = "#FBCA11"});this.l1.ItemsSource = list;this.com.ItemsSource = list;//之前的數(shù)據(jù)綁定的寫法this.l3.ItemsSource = list;// this.l3.DisplayMemberPath = "Code";}
}// 模型類
public class Color
{public string Code {  get; set; }//顏色的取值#FF0000
}

http://m.risenshineclean.com/news/60259.html

相關(guān)文章:

  • 網(wǎng)站ip訪問做圖表中國十大新聞網(wǎng)站排名
  • 石家莊網(wǎng)絡(luò)公司行業(yè)深圳百度seo怎么做
  • 微網(wǎng)站做的比較好搜索引擎營銷的主要方式有
  • 南京網(wǎng)站網(wǎng)站建設(shè)學(xué)校如何發(fā)布一個網(wǎng)站
  • 做金融必看網(wǎng)站谷歌在線瀏覽器免費入口
  • 網(wǎng)站建設(shè)欄目說明百度一下就知道官網(wǎng)
  • 企業(yè)網(wǎng)站建設(shè)的思路最優(yōu)化方法
  • 一些做的好的網(wǎng)站東營百度推廣電話
  • 曲阜公司網(wǎng)站建設(shè)價格便宜ui設(shè)計培訓(xùn)班哪家好
  • 淘寶客網(wǎng)站還可以做嗎牛奶軟文廣告營銷
  • 長沙今天最新招聘信息臺州關(guān)鍵詞優(yōu)化平臺
  • 阿里巴巴做網(wǎng)站的電話號碼西安百度推廣怎么做
  • 金融投資網(wǎng)站開發(fā)站長工具是干嘛的
  • 產(chǎn)品經(jīng)理培訓(xùn)哪個機構(gòu)好湖南正規(guī)seo優(yōu)化
  • 做網(wǎng)站的人還能做什么公司網(wǎng)站建設(shè)要多少錢
  • 做網(wǎng)站怎樣連數(shù)據(jù)庫關(guān)鍵詞推廣效果分析
  • 做視頻網(wǎng)站視頻放在哪里域名怎么注冊
  • 如何做電影網(wǎng)站賺錢嗎刷百度指數(shù)
  • 營銷型網(wǎng)站建設(shè)公司云服務(wù)器
  • 網(wǎng)站建設(shè)捌金手指下拉一南寧推廣軟件
  • 瓊海網(wǎng)站建設(shè)太原seo報價
  • 目前最火的自媒體平臺seo網(wǎng)站關(guān)鍵詞排名優(yōu)化公司
  • 做韓國網(wǎng)站有哪些東西嗎手機網(wǎng)站排名優(yōu)化軟件
  • 響應(yīng)式網(wǎng)站底部菜單欄廣州競價托管公司
  • 廣州網(wǎng)站建站房管局備案查詢網(wǎng)站
  • 用.net core 做網(wǎng)站公司企業(yè)網(wǎng)站建設(shè)
  • 新手學(xué)做網(wǎng)站的教學(xué)書百度怎么搜索圖片
  • 做導(dǎo)航網(wǎng)站賺錢嗎搜索推廣公司
  • 滿屏網(wǎng)站做多大尺寸網(wǎng)絡(luò)平臺建設(shè)及運營方案
  • 山西做網(wǎng)站的企業(yè)站長工具官網(wǎng)域名查詢