This project has moved and is read-only. For the latest updates, please go here.

WPF 3.5 Solution

Dec 20, 2011 at 9:33 PM

I have not been able to use the WPF 3.5 Solution.

My test application has just a RichTextBox and a RichTextBoxFormatBar.

First compilation gives 3 errors in the CSC file (?). These 3 errors disappear in the second compilation but then the designer says it can't find the resource RichTextBoxFormatBar.xaml . I copied this file to ...\Development\Feature - Theming\ExtendedWPFToolkitSolution_35\Src\WPFToolkit.Extended\obj\Debug and then compilation is OK.

When I execute the code, I get an exception 'Cannot locate resource 'richtextboxformatbar.xaml'.

I cannot figure out what's going on and I need to modify the source code for my application.

Help will be much appreciated.


Dec 20, 2011 at 9:36 PM

You don't want to use the Development branch.  Compile the Main branch.  Just be aware that I don't always sync the 3.5 solution with the 4.0 code until I get closer to a release.  So some featuyes may not yet be in the 3.5 solution.

Dec 21, 2011 at 10:27 AM

Hi Brian,


The same happens with the Main branch.

"Cannot create instance of 'RichTextBoxFormatBar' defined in assembly 'WPFToolkit.Extended, Version=, Culture=neutral, PublicKeyToken=3e4669d2f30244f4'. Exception has been thrown by the target of an invocation. Error at object 'rtbReport' in markup file 'WPFToolkit.Extended.Examples;component/window1.xaml' Line 9 Position 18."

Here is the Windows1.xaml:



Window x:Class=WPFToolkit.Extended.Examples.Window1 xmlns=""  



        Title="Window1" Height="300" Width="300">


          <extToolkit:RichTextBox Name="rtbReport" AcceptsTab="True" AllowDrop="True" HorizontalScrollBarVisibility="Visible"

                                  VerticalScrollBarVisibility="Visible" >


                    <extToolkit:RichTextBoxFormatBar Height="102" Width="222"/>



     </Grid> >


Here is the stack trace:

 at System.Windows.Markup.XamlParseException.ThrowException(String message, Exception innerException, Int32 lineNumber, Int32 linePosition, Uri baseUri, XamlObjectIds currentXamlObjectIds, XamlObjectIds contextXamlObjectIds, Type objectType)
at System.Windows.Markup.XamlParseException.ThrowException(ParserContext parserContext, Int32 lineNumber, Int32 linePosition, String message, Exception innerException)
at System.Windows.Markup.BamlRecordReader.CreateInstanceFromType(Type type, Int16 typeId, Boolean throwOnFail)
at System.Windows.Markup.BamlRecordReader.GetElementAndFlags(BamlElementStartRecord bamlElementStartRecord, Object& element, ReaderFlags& flags, Type& delayCreatedType, Int16& delayCreatedTypeId)
at System.Windows.Markup.BamlRecordReader.BaseReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(BamlElementStartRecord bamlElementRecord)
at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord)
at System.Windows.Markup.BamlRecordReader.Read(Boolean singleRecord)
at System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment()
at System.Windows.Markup.TreeBuilder.Parse()
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at WPFToolkit.Extended.Examples.Window1.InitializeComponent() in c:\Users\adolfo.PHISYSTEMS\Downloads\wpftoolkit-83405\Main\Source\ExtendedWPFToolkitSolution_35\Src\WPFToolkit.Extended.Examples\Window1.xaml:line 1
at WPFToolkit.Extended.Examples.Window1..ctor() in C:\Users\adolfo.PHISYSTEMS\Downloads\wpftoolkit-83405\Main\Source\ExtendedWPFToolkitSolution_35\Src\WPFToolkit.Extended.Examples\Window1.xaml.cs:line 24




Dec 21, 2011 at 2:41 PM

When you sdownload the source code you need to right click the zip file and select Properties.  Then click the unblock button.  Now unzip the code and compile.

Dec 21, 2011 at 3:18 PM

Sorry, same behavior.

Dec 21, 2011 at 3:26 PM

Don't know what to tell you.  Works for me and I can't reproduce your issue.  You have the source code available so you may have to do some research.  The only thing I can think of is that you may need to resign the assembly in the toolkit project properties dialog.

Dec 21, 2011 at 5:57 PM

I resigned the toolkit assembly and the issue persists.

The source code doesn't help  because the exception occurs inside InitializeComponent().

By analogy with what was occuring in design mode, the file RichTextBoxFormatBar.xaml might be expected to be in a folder and is not found there.

Maybe something related to the fact that the source files are not in the 3.5 folders?

By the way, if I use the 4.0 solution everything works.

Dec 21, 2011 at 5:59 PM

Just to let you know, I am not sure how much longer I will be supporting .NET 3.5 anyways.  Not only is it a pain to manage 2 versions, but it is also very time consuming.  As you can see I also don't test the 3.5 solution, only the 4.0 solution.  Thanks for the feed back.