Register  |  Login
 
 
 
 
You are here :- Support
Support Minimize

To post questions on the forum, you must be logged in (Registration is required).  Your information remains confidential, we do not pass or sell any information to third parties.

You can always contact us at support@jastdev.com or you can alternatively use the forum to ask questions.

Print  
Forum Minimize
 
  Support  Docking Control  General  WPF Window crashes at loading time when instanciating DragReceiver in DockingControl constructor.
Previous Previous
 
Next Disabled
New Post 11/14/2008 10:22 PM
  frankidoze
7 posts
No Ranking


WPF Window crashes at loading time when instanciating DragReceiver in DockingControl constructor. 

Hi,

We are interested in getting your DockingControl package for our own development. So I want to try to do my own UI (based on your Demo1) to see how flexible and easy to use is the DockingControl.

And I ran into the following error at loading time:

System.NullReferenceException: Object reference not set to an instance of an object.

   at JaStDev.DockingControl.Controls.DragReceiver..()

   at JaStDev.DockingControl.Controls.DragReceiver...ctor(DragReceiver aOwner)

   at JaStDev.DockingControl.Controls.DragReceiver..ctor(Boolean aWithWindows)

   at JaStDev.DockingControl.Controls.DockingControl.


(Object , RoutedEventArgs )

   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)

   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)

   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)

   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)

   at System.Windows.FrameworkElement.OnLoaded(RoutedEventArgs args)

   at MS.Internal.FrameworkObject.OnLoaded(RoutedEventArgs args)

Here is the xaml I used:

        <d:DockingControl x:Name="dockingControl" Background="Transparent">
            <d:ToolFrame Name="orgUnit" Dock="Left" Location="Visible" IsDropTarget="True" TrueFloating="True">
                <d:ToolFrameItem x:Name="orgUnitToolItem" Source="OrgUnitTool.xaml" Title="Organization Unit" />
            </d:ToolFrame>
            <d:ToolFrame Name="settings" Dock="Left" Location="Visible" RelativeTo="orgUnit" TrueFloating="True" IsDropTarget="True">
                <d:ToolFrameItem x:Name="settingsItem" Source="OrgUnitSettingsTool.xaml" Title="Settings" />
            </d:ToolFrame>
            <d:ToolFrame Name="body" HasHeader="False" 
                      TabStripPlacement="Top"
                      CanClose="False"
                      TabVisibility="Visible"
                      IsDropTarget="False"
                      CanPersist="False" TrueFloating="True">
                <d:ToolFrameItem Source="Alarm.xaml"  Title="Alarm" IsDocument="False" />
            </d:ToolFrame>
        </d:DockingControl>

 

When I comment out this portion of xaml, my WPF window loads without a problem.

The pages define here for each ToolFrame don't do anything. They are just pages for now as I want to test the floating/docking effect.

What am I missing?

Thank you for your help.

Frankidoze

 
New Post 11/15/2008 2:08 PM
  bragi
12 posts
10th Level Poster


Re: WPF Window crashes at loading time when instanciating DragReceiver in DockingControl constructor. 
Modified By bragi  on 11/15/2008 6:12:18 AM)

Hello,

This defently looks like a bug.  I will investigate this some further.  A couple of  questions:

  • are you redefining the template for the dockingcontrol somehow through a style or controltemplate?
  • are you developing an xbap application or stand alone app?
  • What are the security rights of your application, can it create top level windows and popups?

Thanks,

Bragi.

 
New Post 11/17/2008 4:17 PM
  frankidoze
7 posts
No Ranking


Re: WPF Window crashes at loading time when instanciating DragReceiver in DockingControl constructor. 

Hello,

Q1: I am not using any style or controltemplate, I have just define the pasted code (see previous post) in a Page.xaml

Q2: Stand alone

Q3:I haven't define any security for this application so far. I run it on my laptop (I'm an admin).

 What am I doing is trying to use DockingControl mostly inspired by your Demo1 which works perfectly. I am missing probably something but I couldn't find what. I am just starting with WPF.

 I could send you my project if that could help.

Thanks,

Frankidoze

 
New Post 11/17/2008 4:24 PM
  bragi
12 posts
10th Level Poster


Re: WPF Window crashes at loading time when instanciating DragReceiver in DockingControl constructor. 

Hello,

Yes, that would help me a lot, that way I can easely reproduce the error. You can send the project at support@jastdev.com if you don't mind.

 
New Post 11/17/2008 6:05 PM
  frankidoze
7 posts
No Ranking


Re: WPF Window crashes at loading time when instanciating DragReceiver in DockingControl constructor. 

Hi again,

Just sent the project with my gmail account carrying the same message title.

Thanks

Frankidoze

 
New Post 11/17/2008 6:44 PM
  frankidoze
7 posts
No Ranking


Re: WPF Window crashes at loading time when instanciating DragReceiver in DockingControl constructor. 

Hi,

Here some behaviour:

Case A, from a WinForm

If I call, my WPF window from a winform (I have created a new winform that calls the WPF when pressing a button), I have an exception indicating "Object reference not set to an instance of an object." on "Application.Run(new Form1());". Strange.

Code used to open the WPF window in button click event:

            var wpfwindow = new eSense.DashBoard();
            ElementHost.EnableModelessKeyboardInterop(wpfwindow);
            wpfwindow.Show();

 

Case B

I have add all my WPF Pages to your Demo1 project and I call my main page instead of yours: Works perfectly.

 

I guess there is something either in WPF or perhaps in DockingControl (and probably underlying WPF stuff) that breaks when a WPF winform is opened from a WinForm.

 

Hope that helps.

Thanks

Frankidoze

 
New Post 11/17/2008 7:21 PM
  bragi
12 posts
10th Level Poster


Re: WPF Window crashes at loading time when instanciating DragReceiver in DockingControl constructor. 

Ok, Thanks a bunch.  This appears to be a bug in the dockingcontrol library while working in a winforms environment.  I will track down the bug and post an update when fixed.

Bragi.

 
New Post 11/18/2008 3:24 PM
  bragi
12 posts
10th Level Poster


Re: WPF Window crashes at loading time when instanciating DragReceiver in DockingControl constructor. 

Hello,

I have found the problem.  It really is 2 fold.  The problem originates in the fact that you are declaring the pages (or user controls) in an external library.  Because of this, the URI to the resource changes to:

Source="/eSense.DAC;component/OrgUnitTool.xaml"

Note how I put the '/eSense.DAC;component' in front of the resource name.  This is required to indicate the assembly that contains the xaml resource.

This error situation wasn't properly caught and caused a null reference exception.  So, the fastest way for you to continue is to simply update the 'Source' property on all the ToolFrameItems.  Here's a complete copy of your DockingControl implementation, corrected (also note I removed a 'Width property on one of the ToolFrames, which caused it to resize incorrectly):

<d:DockingControl x:Name="dockingControl" Background="Transparent">
            <d:ToolFrame Name="orgUnit" Dock="Left" Location="Visible" IsDropTarget="True" TrueFloating="True" Width="150" >
                <d:ToolFrameItem x:Name="orgUnitToolItem" Source="/eSense.DAC;component/OrgUnitTool.xaml" Title="Organization Unit" />
            </d:ToolFrame>
            <d:ToolFrame Name="settings" Dock="Bottom"  Location="Visible" RelativeTo="orgUnit" TrueFloating="True" IsDropTarget="True" Height="150">
                <d:ToolFrameItem x:Name="settingsItem" Source="/eSense.DAC;component/OrgUnitSettingsTool.xaml" Title="Settings" />
            </d:ToolFrame>
            <d:ToolFrame Name="body" HasHeader="False" 
                      TabStripPlacement="Top"
                      CanClose="False"
                      TabVisibility="Visible"
                      IsDropTarget="False"
                      CanPersist="False" TrueFloating="True">
                <d:ToolFrameItem Source="/eSense.DAC;component/Alarm.xaml"  Title="Alarm" IsDocument="False" />
            </d:ToolFrame>
        </d:DockingControl>

 

In the mean time, I will update the library so that the error situation is handled more gracefully.

Thank you for the Feedback.

Bragi.

 
New Post 11/18/2008 7:49 PM
  frankidoze
7 posts
No Ranking


Re: WPF Window crashes at loading time when instanciating DragReceiver in DockingControl constructor. 

Hi Bragi,

 

Well, I still have the same problem. Replace xaml with the one you provide and didn't do the trick for me.

I don't understand your explanation about using an external library as all pages, including the WPF window are in the same dll. For better testing I have created a solution with 2 projects: 1 is a classic winform, the other is a WPF custom control library embedding all WPFcontrols (Window and Page). I guess when you refer to external library is for the WinForm project, that I agree.

If you want I can send to that solution.

Thanks.

Frankidoze

 
New Post 11/19/2008 2:59 PM
  bragi
12 posts
10th Level Poster


Re: WPF Window crashes at loading time when instanciating DragReceiver in DockingControl constructor. 

Hello,

After I got your code, I first ran it, saw what was going on, fixed it, and only later changed the URI reference since I had a suspision that was causing it.  I figured simply fixing this URI might have also fixed the problem, I guess it didnt. sorry for that. Anyway, I got it running here, so I will make a new release of the bugfix and send it to you.

The idea behind the URI is this: everything is indeed declared in the same assembly, but during execution, the 'main' assembly (that of the application) is not the same as the assembly in which the resource was defined.  WPF starts looking in the application assembly, not in the declaring assembly.  I hope that explains it a little.

Cheers.

Bragi.

 
Previous Previous
 
Next Disabled
  Support  Docking Control  General  WPF Window crashes at loading time when instanciating DragReceiver in DockingControl constructor.
Print