This project is read-only.

Contents resize problem if changing resource

Jul 14, 2010 at 9:54 AM
Edited Jul 14, 2010 at 9:58 AM

Hello, I am trying to apply this control and I have a problem. I prepared the ribbon and I added the images, labels, headers, etc... via merged dictionaries resource with DynamicResource tags.
When I change the resource content (resource file) the controls - ribbongroupboxes and buttons text - size don not resized automatically.
If I try resize manually the activated panel is resizing, but the inactiveted panels are not.

How can I solve this problem?

Sample:

App.XAML (load dictionaries):
...
<Application.Resources>
<ResourceDictionary>
  <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Office2010/Blue.xaml"/>
    <ResourceDictionary Source="MainWindow.Dictionary.EN.xaml"/>
  </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
...

MainWindow.Dictionary.EN.XAML (create string resource):
...
<ResourceDictionary
xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
xmlns:System="clr-namespace:System;assembly=mscorlib">

<System:String x:Key="blablabla.Text">Blablabla...</System:String>
...

MainWindow.XAML (add value to Header):
...
<r:RibbonGroupBox Name="blablabla" Header="{DynamicResource blablabla.Text}">
  <r:Button Text="{DynamicResource blablabla2.Text}" SizeDefinition="{DynamicResource blablabla2.SizeDefinition}" Icon="{DynamicResource blablabla2.Icon}" LargeIcon="{DynamicResource blablabla2.Icon}"/>
  <r:Button Text="{DynamicResource blablabla3.Text}" SizeDefinition="{DynamicResource blablabla3.SizeDefinition}" Icon="{DynamicResource blablabla3.Icon}" LargeIcon="{DynamicResource blablabla3.Icon}"/>
...

MainWindow.CS (change resource):
...
Application.Current.Resources.BeginInit();
Application.Current.Resources.MergedDictionaries.Clear();
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri(pack://application:,,,/Fluent;component/Themes/Office2010/Blue.xaml) });
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = new Uri("MainWindow.Dictionary.DE.xaml", UriKind.Relative) }); Application.Current.Resources.EndInit();
...

Thanks, sinick

(Sorry, my english is not good...)

Jul 15, 2010 at 10:15 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.