Error when using ribbon

Apr 20, 2010 at 11:10 AM
Edited Apr 20, 2010 at 1:47 PM

Hello,

 

I am getting following error in

 

 

 

I have subclassed RibbonWindow when calling Show method. I am getting below error.

 

'Set property 'System.Windows.ResourceDictionary.Source' threw an exception.' Line number '48' and line position '12'.

 

BaseURI:{pack://application:,,,/Fluent;component/Themes/Office2010/Controls/Backstage.xaml}

 

StackTrace:

 

   at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
   at System.Windows.Markup.WpfXamlLoader.LoadDeferredContent(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings parentSettings, Uri baseUri)
   at System.Windows.ResourceDictionary.CreateObject(KeyRecord key)
   at System.Windows.ResourceDictionary.RealizeDeferContent(Object key, Object& value, Boolean& canCache)
   at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
   at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
   at System.Windows.DeferredResourceReference.GetValue(BaseValueSourceInternal valueSource)
   at System.Windows.DependencyPropertyChangedEventArgs.get_NewValue()
   at System.Windows.Controls.Control.OnTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.StyleHelper.ApplyStyleOrTemplateValue(FrameworkObject fo, DependencyProperty dp)
   at System.Windows.StyleHelper.InvalidateContainerDependents(DependencyObject container, FrugalStructList`1& exclusionContainerDependents, FrugalStructList`1& oldContainerDependents, FrugalStructList`1& newContainerDependents)
   at System.Windows.StyleHelper.DoStyleInvalidations(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle)
   at System.Windows.StyleHelper.UpdateStyleCache(FrameworkElement fe, FrameworkContentElement fce, Style oldStyle, Style newStyle, Style& styleCache)
   at System.Windows.FrameworkElement.OnStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)
   at System.Windows.FrameworkElement.UpdateStyleProperty()
   at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
   at System.Windows.Controls.Primitives.Selector.OnInitialized(EventArgs e)
   at Fluent.Backstage.OnInitialized(EventArgs e) in C:\Users\Sergey\Documents\Visual Studio 2008\Projects\Fluent\Fluent\Backstage.cs:line 93

 

 

 

InnerException: "Cannot locate resource 'themes/office2010/controls/scrollbarwhite.baml'.". I am using Windows7, VS2010 RTM and RibbonControlsutie 1.2. Please tell me if i am missing something.

 

 

 

In Design time when i tried the sample. below error is shown in the error list.

 

Error 1 Unable to load the metadata for assembly 'Fluent'. This assembly may have been downloaded from the web.  See http://go.microsoft.com/fwlink/?LinkId=179545.  The following error was encountered during load: Could not load file or assembly 'Fluent, Version=1.2.0.0, Culture=neutral, PublicKeyToken=3e436e32a8c5546f' or one of its dependencies. The system cannot find the file specified. C:\Mohan\Mohan\My Work\Network Management\WPF\WPFRibbonCTP\Fluent Ribbon Control Suite 1.2\.NET 4\Samples\Galleries\Window.xaml 1 1 Fluent.Sample.Galleries..

 

 

 

I tried to compile the Fluent 1.2 code in VS2010 RTM. Then I was getting errors in BackStage.xaml and Gallery.xaml. in the below controltemplate.

 

       <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
          <ResourceDictionary Source="pack://application:,,,/Fluent;component\Themes\Office2010\Controls\ScrollBarWhite.xaml"/>
        </ResourceDictionary.MergedDictionaries>
        <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource ScrollBarWhite}"/>
        <Style x:Key="{x:Type Fluent:Button}" TargetType="{x:Type Fluent:Button}" BasedOn="{StaticResource BackstageButtonStyle}"/>
      </ResourceDictionary>.

 

Now I have commented these resources in both the files and working fine.  for time being I am using this. Please suggest me a workaround.

Also I have found the below link there is an issue in VS2010 beta.

http://connect.microsoft.com/VisualStudio/feedback/details/498844/wpf-designer-throws-invalidcastexception


.

 

Coordinator
Apr 21, 2010 at 6:15 AM

Very strange. Try/check:

  • Whether you have Fluent.dll registered in GAC. Remove it
  • Whether you have 'en-us' folder in bin folder. Delete it
  • Source control issue?
  • VS 2010 BETA->RC->RTM transition issue?

Unfortunately I have no more ideas yet

Apr 21, 2010 at 8:55 AM

Hello Daniel,

Thanks for your information. I tried Fluent.dll is not in the GAC. en-us folder is also not in the bin folder. Is it working in your end with windows 7 and RTM?.

Coordinator
Apr 21, 2010 at 10:21 AM

Yes, we have Windows 7 x64, Visual Studio 2010 RTM with NET 4.0.30319 on our PCs.

Apr 21, 2010 at 10:25 AM

Thanks for your reply.

Coordinator
Apr 21, 2010 at 1:28 PM

I tried to compile the Fluent 1.2 code in VS2010 RTM. Then I was getting errors in BackStage.xaml and Gallery.xaml. in the below controltemplate

What kind of errors?

Apr 21, 2010 at 1:46 PM
Edited Apr 21, 2010 at 1:56 PM

Error 81 Unable to cast object of type 'Microsoft.Expression.DesignModel.DocumentModel.DocumentCompositeNode' to type 'System.Windows.ResourceDictionary'. C:\Mohan\Mohan\My Work\Network Management\WPF\WPFRibbonCTP\Fluent\Fluent\Themes\Office2010\Controls\Backstage.xaml 46 7 Fluent


Error 82 Unable to cast object of type 'Microsoft.Expression.DesignModel.DocumentModel.DocumentCompositeNode' to type 'System.Windows.ResourceDictionary'. C:\Mohan\Mohan\My Work\Network Management\WPF\WPFRibbonCTP\Fluent\Fluent\Themes\Office2010\Controls\Gallery.xaml 24 11 Fluent

Apr 26, 2010 at 7:36 AM
Edited Apr 26, 2010 at 10:14 AM

Hello Daniel,

Did you manage to look into this error. I am facing this error in two of our computers having Windows 7 and VS2010 RTM?.

Thanks,

Mohan