silverlight引用皮肤经常出现的问题.doc

上传人:壹****1 文档编号:543703788 上传时间:2023-12-14 格式:DOC 页数:7 大小:105.01KB
返回 下载 相关 举报
silverlight引用皮肤经常出现的问题.doc_第1页
第1页 / 共7页
silverlight引用皮肤经常出现的问题.doc_第2页
第2页 / 共7页
silverlight引用皮肤经常出现的问题.doc_第3页
第3页 / 共7页
silverlight引用皮肤经常出现的问题.doc_第4页
第4页 / 共7页
silverlight引用皮肤经常出现的问题.doc_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《silverlight引用皮肤经常出现的问题.doc》由会员分享,可在线阅读,更多相关《silverlight引用皮肤经常出现的问题.doc(7页珍藏版)》请在金锄头文库上搜索。

1、这个问题相信很多人遇见,我也遇见过。所以我找到了解决的方法先看一个效果:这是引用sl4的toolkit皮肤的默认效果这是引用了Bureaublue的效果:这是引用了ExpressionDark的效果:我们看一下前台代码: 我们看见ComboBox有个SelectionChanged事件,事件的代码如下:private void comboBox2_SelectionChanged(object sender, SelectionChangedEventArgs e) if (comboBox2.SelectedValue.ToString()!=) ComboBoxItem item = co

2、mboBox2.SelectedValue as ComboBoxItem; SwitchTheme(item.Content.ToString(); /切换皮肤的方法 void SwitchTheme(string themeName) ResourceDictionary rd = new ResourceDictionary(); rd.Source = new Uri( string.Format( /SwitchThemes;component/Assets/0Theme.xaml ,themeName ), UriKind.Relative); Application.Curren

3、t.Resources.MergedDictionaries.Add(rd); 我们再看一段代码: void SwitchTheme(string themeName) ResourceDictionary rd = new ResourceDictionary(); rd.Source = new Uri( string.Format( Assets/0Theme.xaml ,themeName ), UriKind.Relative); Application.Current.Resources.MergedDictionaries.Add(rd); 感觉这段代码没有错误,但是这时候却报异

4、常如下图:为什么呢?我也不明白,我只知道这是silverlight的路径的一种引用方式吧,如果我们把代码稍微一改就不会出错了,改成这样:void SwitchTheme(string themeName) ResourceDictionary rd = new ResourceDictionary(); rd.Source = new Uri( string.Format( /SwitchThemes;component/Assets/0Theme.xaml ,themeName ), UriKind.Relative); Application.Current.Resources.MergedDictionaries.Add(rd); 这时候问题就解决了2.但是很多人不是因为这个问题,而是因为ComboBox的问题,出现上面的异常前台代码: comboBox2_SelectionChanged代码:private void comboBox2_SelectionChanged(object sender, SelectionChangedEventArgs e) if (comb

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号