欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
WPF XAML 為項目設置全局樣式

全局資源樣式屬性

App.xaml

<Application.Resources> <ResourceDictionary><br> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Dictionary.xaml"/> </ResourceDictionary.MergedDictionaries><br> <Style x:Key="xxx" TargetType="Button"> <Setter Property="Foreground" Value="White"></Setter> <Setter Property="FontSize" Value="30"></Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Grid></Grid> </ControlTemplate> </Setter.Value> </Setter></Style> <ControlTemplate x:Key="xx" TargetType="Button"> <Grid></Grid> </ControlTemplate> </ResourceDictionary></Application.Resources>

說(shuō)明:

1.行類(lèi)屬性盡量少用,只有特殊控件 需要用到行內屬性,

   正確的做法是封裝統一風(fēng)格的所有控件。
  (例如按鈕,統一高寬,字體,字體大小,然后申明到獨立的資源字典中,
    在A(yíng)pp.xaml中引用)

2.頭部資源引用情況用于 不同 Window 適應不同主題或者風(fēng)格的情況。

   比如為某一個(gè)窗口申明一個(gè)當前窗口單獨使用的樣式。

  (例如播放器的旋轉控件,只有一個(gè)頁(yè)面用到,只需要在Window級引用對應資源字典)

   不放在A(yíng)pp.xaml原因是為了降低內存消耗。

3.App.xaml 里面的資源引用適用于全局資源。理論上每一個(gè)被申明的Window
   都會(huì )創(chuàng )建一個(gè)對應資源字典的實(shí)例。除非是每個(gè)Window都會(huì )用到的模塊,
    不然建議放到對應Window級

經(jīng)典實(shí)例:

ControlStyle.xaml<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:DemoForm.UI"> <Style x:Key="BtnControl" TargetType="Button"> <Setter Property="FontSize" Value="15"/> <Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="Height" Value="40"/> <Setter Property="Margin" Value="2"/> <!--<Setter Property="Background" Value="Red"/>--></Style></ResourceDictionary>
App.xaml<Application x:Class="DemoForm.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:DemoForm" StartupUri="MainWindow.xaml">
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/UI/ControlStyle.xaml"></ResourceDictionary> <!--或者這樣方式DemoForm;component/UI/Dictionary1.xaml 引用以后就可以繼承了--> </ResourceDictionary.MergedDictionaries> <Style BasedOn="{StaticResource BtnControl}" TargetType="Button" > <Setter Property="FontSize" Value="10" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="Height" Value="40" /> <Setter Property="Margin" Value="2" /> <Setter Property="Template"> <!--應用于全局的控件模板--> <Setter.Value> <ControlTemplate TargetType="Button"> <Border BorderThickness="1" CornerRadius="10" Background="{TemplateBinding Background}"> <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/> </Border> <ControlTemplate.Triggers > <Trigger Property="Button.IsMouseOver" Value="True"> <Setter Property="Button.Background" Value="blue"/> </Trigger > </ControlTemplate.Triggers > </ControlTemplate> </Setter.Value> </Setter></Style> <Style TargetType="Label"> <!--//x:Key="LblStyle"去掉就是全局引用--> <Setter Property="FontSize" Value="12" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" /></Style> <Style TargetType="TextBox"> <!--//x:Key="TxtStyle" 去掉就是全局引用--> <Setter Property="FontSize" Value="12" /> <Setter Property="HorizontalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="MaxHeight" Value="50" /> <Setter Property="MinWidth" Value="80" /> <Setter Property="Margin" Value="2" /></Style> <!--<ControlTemplate x:Key="buttonTemplate" TargetType="Button" > <Border BorderThickness="1" CornerRadius="10" Background="{TemplateBinding Background}"> <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/> </Border> <ControlTemplate.Triggers > <Trigger Property="Button.IsMouseOver" Value="True"> <Setter Property="Button.Background" Value="blue"/> </Trigger > </ControlTemplate.Triggers > </ControlTemplate >--> </ResourceDictionary> </Application.Resources></Application>
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
閑話(huà)WPF之二五(WPF中的ControlTemplate [3])
C# WPF 一個(gè)設計界面
WPF自定義按鈕顯示效果
WPF自定義控件與樣式(7)
WPF 詳解模板
(轉) silverlight 樣式學(xué)習
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久