<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      WPF整理-使用ResourceDictionary管理Logical Resources

      “Logical resources may be of various types, such as brushes, geometries, styles, and templates.
      Placing all those resources in a single file such as App.xaml hinders maintainability. A better
      approach would be to separate resources of different types (or based on some other criteria) to
      their own files. Still, they must be referenced somehow from within a common file such as App.
      xaml so they are recognized.”

      為了增加資源文件的可維護性,我們應該使用ResourceDictionary對資源進行:分類、匯總。

      如何實現呢?舉個例子

      1.新建一個WPF Application,在Application中添加一個New Item,選擇ResourceDictionary。

      譬如,命名為Brushes.xaml,我們用它來存放一些筆刷。打開,我們添加一個筆刷如下:

      Brushes.xaml:

      <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
          <LinearGradientBrush EndPoint="1,0" x:Key="brush1">
              <GradientStop Color="Violet" Offset="0" />
              <GradientStop Color="Orange" Offset=".7" />
              <GradientStop Color="Brown" Offset="1" />
          </LinearGradientBrush>
      </ResourceDictionary>

      2.在App.xaml中Merge則個Resource。
      “Open App.xaml. We need to merge external resource dictionaries into the main
      application dictionary.

      打開App.xaml,添加如下內容:

      <Application x:Class="ManagingLogicalResources.App"
                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                   StartupUri="MainWindow.xaml">
          <Application.Resources>
              <ResourceDictionary>
                  <ResourceDictionary.MergedDictionaries>
                      <ResourceDictionary Source="Brushes.xaml"/>
                  </ResourceDictionary.MergedDictionaries>
              </ResourceDictionary>
          </Application.Resources>
      </Application>

      3.這樣我們就可以在頁面中正常使用了。

      <Window x:Class="ManagingLogicalResources.MainWindow"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              Title="MainWindow" Height="350" Width="525">
          <Grid>
              <Ellipse Fill="{StaticResource brush1}"/>
          </Grid>
      </Window>

      效果如下:

       -----------------------------------

      在實際開發中更常用的做法是:直接在使用的View內部Merge。

      <Window x:Class="WPFMergedDicitonary.MainWindow"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              Title="MainWindow" Height="350" Width="525">
          <Window.Resources>
              <ResourceDictionary>
                  <ResourceDictionary.MergedDictionaries>
                      <ResourceDictionary Source="Brushes.xaml"/>
                  </ResourceDictionary.MergedDictionaries>
              </ResourceDictionary>
          </Window.Resources>
          <Grid>
              <Ellipse Fill="{StaticResource brush1}"/>
          </Grid>
      </Window>

      效果同上,如下:

      posted @ 2013-07-02 22:03  DebugLZQ  閱讀(14988)  評論(8)    收藏  舉報
      主站蜘蛛池模板: 少妇真人直播免费视频| 久久亚洲精品11p| 欧美成人www免费全部网站| 四虎影视永久无码精品| 特级做a爰片毛片免费看无码 | 亚洲各类熟女们中文字幕| 国产精品一区二区三区蜜臀| 日韩少妇人妻vs中文字幕| 成在线人永久免费视频播放| 男女xx00上下抽搐动态图| 久久亚洲精品中文字幕馆| 最近中文字幕免费手机版| 精品国产久一区二区三区| AV在线亚洲欧洲日产一区二区| 永久免费无码网站在线观看| 国产一精品一av一免费爽爽| 日韩大片看一区二区三区| 妺妺窝人体色WWW看人体| 激情五月开心婷婷深爱| 米奇亚洲国产精品思久久| 欧美乱强伦xxxx孕妇| 91福利视频一区二区| 久久一日本道色综合久久| 秋霞鲁丝片成人无码| 双辽市| 少妇无码av无码专区在线观看| 色爱综合另类图片av| 秋霞av鲁丝片一区二区 | 国产99视频精品免视看9| 午夜福利看片在线观看| 久久熟女| 无码成人午夜在线观看| 国产女同疯狂作爱系列| 国产99久久精品一区二区| 国语精品自产拍在线观看网站| 国产精品白丝久久av网站| 成人精品视频一区二区三区尤物| 四虎国产精品永久在线| 国产视频最新| 久久久精品国产精品久久| 国产中文字幕精品喷潮|