I'm currently writing a Silverlight 4 app, and I'm getting an error that I don't understand. I'm trying to execute the following and it's getting this error in the debugging output. Can someone tell me what I am doing wrong and how to fix it?
Public Sub btnHelp_Click()
Bxf.Shell.Instance.ShowView(GetType(HelpView).AssemblyQualifiedName, String.Empty, New Help_ViewModel, "Main")
End Sub
Step into: Stepping over method without symbols 'Bxf.Shell.Instance.get'
Step into: Stepping over method without symbols 'System.RuntimeType.AssemblyQualifiedName.get'
Step into: Stepping over method without symbols 'Designer.Help_ViewModel.Help_ViewModel'
Step into: Stepping over method without symbols 'Bxf.Shell.ShowView'
A first chance exception of type 'System.InvalidCastException' occurred in Bxf
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Step into: Stepping over method without symbols 'Bxf.Xaml.TriggerAction.CallMethod'
A first chance exception of type 'System.InvalidCastException' occurred in Bxf
Step into: Stepping over method without symbols 'MS.Internal.JoltHelper.FireEvent'
The program '[4440] chrome.exe: Silverlight' has exited with code 0 (0x0).
The program '[2304] w3wp.exe: Managed (v2.0.50727)' has exited with code 0 (0x0).
Is the application running ok otherwise? Its normal for exceptions to be thrown caught and handled during the course of a running application.
Yes the application is running normal until I execute that line. When executed, the app goes blank, and I have to refresh the browser. If it's any constellation, the view is a child window instead of a usercontrol.
I still haven't been able to resolve this issue or even understand what I'm doing wrong. Can anyone please help?
Public Sub New
AddHandler presenter.OnShowView, Sub(view, region)
Select Case region
Case "Main"
MainContent = view
Case "Menu"
MenuContent = view
Case "Samples"
SampleContent = view
Case "Product"
ProductContent = view
Case "Error"
_errorClose = DateTime.Now.Add(New TimeSpan(0, 0, 5))
ErrorContent = view
Case "User"
UserContent = view
Case "Modal"
Dim cw As New ChildWindow
cw.Content = view
AddHandler cw.Closed, Sub() cw.DialogResult = False
cw.Show()
Case "Status"
_statusClose = DateTime.Now.Add(New TimeSpan(0, 0, 5))
If view IsNot Nothing Then
AppBusy = DirectCast(view, Bxf.Status).IsBusy
Else
AppBusy = False
End If
StatusContent = view
End Select
End Sub
End Sub
Public Sub btnHelp_Click()
Bxf.Shell.Instance.ShowView(GetType(HelpView).AssemblyQualifiedName, String.Empty, New Help_ViewModel, "Modal")
End Sub
You should understand that Bxf doesn't actually do anything beyond route the ShowView method call to your OnShowView handler.
The secret to almost all debugging is to put a breakpoint at the top of the OnShowView handler and step through it.
ok... I'm still stumped. Whats wrong with my handler?
ok I found the exact culprit in my problem.
Dim vf As New Bxf.ViewFactory
Dim v = vf.GetView(GetType(View.ProductCategoryListView).AssemblyQualifiedName, "productcategorylistViewSource", New ViewModel.ProductCategoryList_ViewModel)
Bxf.Shell.Instance.ShowView(v, "Menu")
When I make this approach on the ShowView method, It says it is unable to cast Bxf.View to UserControl. How can I correct this?
This whole thread should be in the Bxf forum at http://bxf.codeplex.com - it has nothing to do with CSLA...
Bxf assumes that views subclass UserControl. The assumption is that your entire UI is composed of UserControl subclassed views that are "hosted" or displayed in regions that are contained in things like a Windows, Page, ChildWindow, etc.
Copyright (c) Marimer LLC