开发者

How to load Resources in view level

Even thow it's the most comfortable way to merge all resources on application level it can also cost performance by loading all resources at startup. A better approach is to load only often used resources and load the other on view level.

How to load开发者_如何学运维 Resources in view level?


Put them in a resource dictionary and then merge the resource dictionary at the UserControl or Window level. For example:

<UserControl ...>
<UserControl.Resources>
  <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
      <ResourceDictionary Source="NameOfYourDictionary.xaml"/>
      <ResourceDictionary Source="Dictionary2.xaml"/>
    </ResourceDictionary.MergedDictionaries>
  </ResourceDictionary>
</UserControl.Resources>
</UserControl>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜