Jump to content
Software FX Community

Winforms interop


peterz

Recommended Posts

Is it possible to host the ChartFx WPF control in a Winforms application? I tried the very simplest Winforms app and got a run time exception. My environment is XP Pro and VS 2008. I'm using the Beta 1 ChartFX WPF which I downloaded last week. All this is running on a VMWare virtual machine.The code I used is:public Form1(){InitializeComponent();System.Windows.Forms.Integration.ElementHost elementHost1 = new System.Windows.Forms.Integration.ElementHost();elementHost1.Dock = DockStyle.Fill;elementHost1.Parent = this;ChartFX.WPF.Chart chart = new ChartFX.WPF.Chart();elementHost1.Child = chart;}This builds so I think all my project's references are valid but when I run the app the exception I get is:System.Windows.Markup.XamlParseException occurred  Message=" Could not load file or assembly 'ChartFX.WPF, Version=0.8.2894.28859, Culture=neutral, PublicKeyToken=a1878e2052c08dce' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)  Error at object 'System.Windows.ResourceDictionary'."  Source="PresentationFramework"  LineNumber=0  LinePosition=0  StackTrace: 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.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.SystemResources.ResourceDictionaries.LoadDictionary(Assembly assembly, String assemblyName, String resourceName, Boolean isTraceEnabled) at System.Windows.SystemResources.ResourceDictionaries.LoadGenericDictionary(Boolean isTraceEnabled) at System.Windows.SystemResources.FindDictionaryResource(Object key, Type typeKey, ResourceKey resourceKey, Boolean isTraceEnabled, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache) at System.Windows.SystemResources.FindResourceInternal(Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference) at System.Windows.StyleHelper.GetThemeStyle(FrameworkElement fe, FrameworkContentElement fce) at System.Windows.FrameworkElement.UpdateThemeStyleProperty() at System.Windows.FrameworkElement.OnInitialized(EventArgs e) at ChartFX.WPF.Chart.OnInitialized(EventArgs e) at System.Windows.FrameworkElement.TryFireInitialized() at System.Windows.FrameworkElement.AddLogicalChild(Object child) at ChartFX.WPF.Chart.d(Object A_0) at ChartFX.WPF.SeriesAttributes.a(Chart A_0) at ChartFX.WPF.SeriesAttributes.OnSetAmbient(IAmbient ambient) at ChartFX.WPF.AllSeriesAttributes.OnSetAmbient(IAmbient ambient) at ChartFX.WPF.Internal.ChildAttributes.ChartFX.WPF.Internal.IRequiresAmbient.set_Ambient(IAmbient value) at a3.a(Object A_0, IAmbient A_1) at ChartFX.WPF.Chart.a(AllSeriesAttributes A_0) at ChartFX.WPF.Chart..ctor() at WindowsFormsApplication1.Form1..ctor() in C:\_Data\Test Code\Slb.Merak.CapitalPlanning.Charts\WindowsFormsApplication1\Form1.cs:line 19  InnerException: System.IO.FileLoadException Message="Could not load file or assembly 'ChartFX.WPF, Version=0.8.2894.28859, Culture=neutral, PublicKeyToken=a1878e2052c08dce' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)" Source="mscorlib" FileName="ChartFX.WPF, Version=0.8.2894.28859, Culture=neutral, PublicKeyToken=a1878e2052c08dce" FusionLog="=== Pre-bind state information ===\r\nLOG: User = NAM\\pzaborski\r\nLOG: DisplayName = ChartFX.WPF, Version=0.8.2894.28859, Culture=neutral, PublicKeyToken=a1878e2052c08dce\n (Fully-specified)\r\nLOG: Appbase = file:///C:/_Data/Test Code/Slb.Merak.CapitalPlanning.Charts/WindowsFormsApplication1/bin/Debug/\r\nLOG: Initial PrivatePath = NULL\r\nCalling assembly : WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.\r\n===\r\nLOG: This bind starts in default load context.\r\nLOG: No application configuration file found.\r\nLOG: Using machine configuration file from C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.\r\nLOG: Post-policy reference: ChartFX.WPF, Version=0.8.2894.28859, Culture=neutral, PublicKeyToken=a1878e2052c08dce\r\nLOG: Attempting download of new URL file:///C:/_Data/Test Code/Slb.Merak.CapitalPlanning.Charts/WindowsFormsApplication1/bin/Debug/ChartFX.WPF.DLL.\r\nWRN: Comparing the assembly name resulted in the mismatch: Revision Number\r\nERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.\r\n" StackTrace:   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)   at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)   at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)   at System.Reflection.Assembly.Load(String assemblyString)   at System.Windows.Markup.ReflectionHelper.LoadAssemblyHelper(String assemblyGivenName, String assemblyPath)   at System.Windows.Markup.ReflectionHelper.LoadAssembly(String assemblyName, String assemblyPath)   at System.Windows.Markup.BamlMapTable.GetAssemblyFromAssemblyInfo(BamlAssemblyInfoRecord assemblyInfoRecord)   at System.Windows.Markup.BamlMapTable.GetTypeFromTypeInfo(BamlTypeInfoRecord typeInfo)   at System.Windows.Markup.BamlMapTable.GetTypeFromId(Int16 id)   at System.Windows.Markup.BamlRecordReader.BaseReadDeferableContentStart(BamlDeferableContentStartRecord bamlRecord, ArrayList& defKeyList, List`1& staticResourceValuesList)   at System.Windows.Markup.BamlRecordReader.ReadDeferableContentStart(BamlDeferableContentStartRecord bamlRecord)   at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord bamlRecord) InnerException:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...