送分题 wpf 换肤

超级管理员9527 2011-08-04 05:17:58
WPF使用动态资源字典换肤

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="brMainBackground" Color="BurlyWood"></SolidColorBrush>
<Image x:Key="imImage1" Source="/Gridplan;component/Images/tool1.bmp"></Image>
</ResourceDictionary>


<Button Height="23" HorizontalAlignment="Left" Margin="0,6,0,0" Name="button1" VerticalAlignment="Center" Width="45" Click="button1_Click" >
<Image Source="{DynamicResource imImage1}"></Image> //这里绑定的
</Button>

运行的时候报异常!!是我的用法不对?还是其他原因呢??
...全文
52 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
刚才试了一下,png也用BitmapImage
  • 打赏
  • 举报
回复
成功
但是,如果是peng类型呢??
Sicr85 2011-08-04
  • 打赏
  • 举报
回复
<BitmapImage x:Key="imImage1" UriSource="/Gridplan;component/Images/tool1.bmp"></BitmapImage>

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧