Problem with VB popup in Silverlight MVVM

1 reply. Last post: October 18, 2010 2:14 AM by Glenn Layaar
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

Hi

need help trying to pop up dialog box (VB) - error in method below (taken from DialogBoxServiceProvider)

Public Shared Sub Show(ByVal modalWindow As IModalWindow, ByVal resultCallback As Action(Of DialogResult))

           Dim element As FrameworkElement = DirectCast(ISFocusManager.GetFocusedElement(), FrameworkElement)

            Dim owner As IWindow = Nothing

            If Not IsNothing(element) Then

                Dim logicalContainer As DependencyObject = ISFocusManager.GetLogicalContainerScope(element)

                If (TypeOf logicalContainer Is IWindow) Then

                    owner = DirectCast(logicalContainer, IWindow)

                End If

            End If

            modalWindow.ShowDialog(owner, resultCallback)

        End Sub


I get an error that 'owner' is nothing on this line below (which it is)....

modalWindow.ShowDialog(owner, resultCallback)

But in c# sample code below (MVVM example) does not cause the same error..

 IWindow owner = null;

Any ideas, thanks

Richard

All times are GMT -5. The time now is 8:23 PM.
Previous Next