This is a migrated thread and some comments may be shown as answers.

Wizard: Cannot create an instance of "StylesGallery"

5 Answers 174 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rob Ainscough
Top achievements
Rank 1
Rob Ainscough asked on 02 Mar 2012, 04:49 PM
Using: Q3 2011 (2011.3.1220.1040) When I double click the RadRichTextBox and run the wizard (I select Word Processor) and use the defaults, after I hit Finish button I get the following error:

Cannot create an instance of "StylesGallery".

"[A]Telerik.Windows.Controls.RadRibbonGallery cannot be cast to [B]Telerik.Windows.Controls.RibbonBar, Version=2011.3.1220.1040, Culture=neutral, PublicKeyToken=..."   


It's a long error message.

UPDATE: I added just about every Telerik DLL reference I could to my project (all same version from 2011.3.1220.1040)  and now I get the following error when I hit Finish button from the RTB Wizard:

"The enumerator is not valid because the collection changed."

UPDATE: I unchecked the "Styles" from the RTB Wizard and it generated the XAML without error.  HOWEVER, when I build my project I'm now getting the following error:

Error 20 Ambiguous type reference. A type named 'ScreenTip' occurs in at least two namespaces, 'Telerik.Windows.Controls' and 'Telerik.Windows.Controls'. Consider adjusting the assembly XmlnsDefinition attributes.

The wizard added the following references in my XAML:

xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonView"

What the heck is going on here?  Any solution to this?

Thanks, Rob

5 Answers, 1 is accepted

Sort by
0
Rob Ainscough
Top achievements
Rank 1
answered on 02 Mar 2012, 06:33 PM
Ok I give up, I guess the RTB Wizard just doesn't work.  It looks like it generates XAML that isn't compatible with Q3 2011 references and adds conflicting references.

It's pretty frustrating that Telerik keeping breaking everything with every new release ... it's as if they just don't care about existing development efforts.  Every time I get a new "release" to fix problems with the prior releases, it breaks working functionality and requires I rename a LOT of XAML references and/or project references.  This isn't helping me so I don't see how it could be good for any other developers using your products.  If Telerik continue to ignore backwards compatibility, then I'll just ignore your products.

VERY Frustrated ... I have tolerance for minor bugs and issues, but not for stuff that breaks on immediate use - that's just a complete lack of testing from your company.  It's hard enough dealing with Microsoft's very buggy VS 2010 SP1, adding a very buggy 3rd part toolkit = endless frustration and projects NOT getting done.  This ISN'T a good thing especially when 3rd part tools are supposed to speed up development, NOT slow it down.

UPDATE: Found this link for documentation (which appears to be out of date as it reference Beta version) RadRichTextBox confusion come on guys/gals ... that documentation is a joke!  If you're using this control verison X but want to use this control Y with that control Z but they don't work together so you have to use Y or X but not Y and Z only if you project has X, Y, and Z blah blah blah ... OMFG!  Are you folks serious?  So I try to see some "demo code" via the link and it's all SL5 now (which BTW doesn't run in a 64bit Browser, just and FYI).  What's your objective here -- push away as many developers as possible?

Rob.
0
Vasil
Telerik team
answered on 05 Mar 2012, 05:34 PM
Hi Rob,

We are sorry to hear that you have experienced problems with our controls.

To start with, we always try to enhance the existing controls with new features and ever greater functionality. Sometimes an existing control (being designed for an older version of the framework) does not provide the means to fully make use of the improvements in the framework. Therefore a new control with similar capabilities has to be implemented.

The introduction of the new ribbon control - RadRibbonView and upgrading RichTextBoxUI to use the improved implementation can cause some issues, but we have done our best to minimize them and to provide maximum customization options with as little effort as possible. The article you have quoted tries to include all cases and list the options, which is why it may be somewhat perplexing.

In a nutshell, the assemblies you have to add are:
  • Telerik.Windows.Controls;
  • Telerik.Windows.Data;
  • Telerik.Windows.Documents;
  • Telerik.Windows.Controls.ImageEditor;
  • Telerik.Windows.Controls.Input;
  • Telerik.Windows.Controls.Navigation;
  • Telerik.Windows.Controls.RibbonView;
  • Telerik.Windows.Controls.RichTextBoxUI. 
For the format providers and the spell-checking dictionary, reference:
  • Telerik.Windows.Documents.FormatProviders.OpenXml for docx;
  • Telerik.Windows.Documents.FormatProviders.Html for HTML;
  • Telerik.Windows.Documents.FormatProviders.Xaml for XAML;
  • Telerik.Windows.Documents.FormatProviders.Rtf for RTF;
  • Telerik.Windows.Documents.FormatProviders.Pdf for PDF;
  • Telerik.Windows.Zip (required by Docx and PdfFormatProvider);

  • Telerik.Windows.Documents.Proofing.Dictionaries.En-US.

With 2012 Q1, if you use RadRichTextBox wizard in a new project, it will add all necessary references and will automatically generate the XAML of the controls. If for some reason, the wizard has not done that, you can copy the XAML code for RadRichTextBoxRibbonUI from our demo.

For 2011 Q3 SP1 (2011.3.1220.1040), please refer to the attached project to see the generated XAML and required assembly references.

I hope with this information you will be able to upgrade your project successfully. If you have other problems, please contact us again.

Greetings,
Vasil
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Rob Ainscough
Top achievements
Rank 1
answered on 05 Mar 2012, 06:04 PM
I've upgraded to 2012 Q1 and SL5, when I run the RadRichTextBox wizard I still get the same error. 

Cannot create an instance of "StyleGallery"

I have the assemblies referenced that you listed.  I also have additional Telerik assemblies (essentially all the Telerik Assemblies in 2012 Q1) ... do I need to "remove" some Telerik assemblies to make this RTB wizard work?

Were you able to see the attached Error image??  This is very frustrating as your answer has not solved my issue at all.


0
Iva Toteva
Telerik team
answered on 05 Mar 2012, 06:19 PM
Hi Rob,

Telerik.Windows.Controls.RadRibbonBar and Telerik.Windows.Controls.RadRichTextBoxRibbonBarUI dlls must not be referenced. 

The two ribbon controls include controls with equal names and cannot be used in the same application, while RadRichTextBoxRibbonBarUI was the dll prepared for backwards compatibility for the developers who would like to keep the old look based on RibbonBar.

Please, try removing the Telerik.Windows.Controls.RadRibbonBar and Telerik.Windows.Controls.RadRichTextBoxRibbonBarUI references, cleaning the solution and dragging RadRichTextBox again.

All the best,
Iva Toteva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Rob Ainscough
Top achievements
Rank 1
answered on 05 Mar 2012, 07:19 PM
Thank you, I removed those from my Project References and it is now working as expected.

It does seem a little odd that even though I don't reference any "instance" in my XAML or code behind that I must make sure they are NOT in my project references.  I've used many 3rd party products in the past an it's pretty unusual to have the current set of assemblies/DLLs (in this case 2012 Q1) that when all are added they will conflict with each other within the same version.  I can understand conflicts "across" different versions but to conflict within the same version is highly irregular (certainly something I've never seen before and hence why I had this problem).

Thank you for the support though, at least you folks are here to help out.

Rob
Tags
RichTextBox
Asked by
Rob Ainscough
Top achievements
Rank 1
Answers by
Rob Ainscough
Top achievements
Rank 1
Vasil
Telerik team
Iva Toteva
Telerik team
Share this question
or