WPF Usercontrol performance vs window performance issue - wpf

I'm making an application to dynamically add user controls on a Canvas and drag them around.
First I made a window with a canvas to drag them in and everything worked fine.
Then i made a user control with the code from the window. I added the control to a new window and everything still was working fine.
Now I try to add my control to the main application and the performance is very slow. The controls still follow the mouse but very slow. The application does have several other user controls. Where does this huge performance hit come from and how can I avoid it?
The cpu only uses 50% and when it was working good it went to 100%.
Thank you for you're help
David
EDIT:
I resolved the problem.
By moving the user-controls there was an error in the image url wich prevented the application to run smoothly.
By changing the url's everything went back to normal.

Ive used JoshSmiths DragCanvas for this kind of thing. It work great with no lag.
JoshSmiths DragCanvas # CodeProject

I resolved the problem. By moving the user-controls there was an error in the image url which prevented the application to run smoothly.
By changing the url's everything went back to normal.
Make sure to check you're url's if you're having sudden performance issues.

Related

EnableModelessKeyboardInterop or WindowInteropHelper when opening a WPF window from a Winforms app

I have a winforms application opening a wpf window. I've used both methods below:
System.Windows.Forms.Integration.ElementHost.EnableModelessKeyboardInterop(window)
and
Dim helper As System.Windows.Interop.WindowInteropHelper = New System.Windows.Interop.WindowInteropHelper(window)
helper.Owner = Me.Handle
I've opted to use the second method, as the application, in random occasions, will fail to display the content of the wpf window, and even crash it. This will occur in different environments (32/64) with xp or 7, and unfortunately, I was never able to reproduce it in development. This window only uses a datagrid, with some interaction done via button controls. Anyways, by switching over to the second method, it seemed to have corrected the issue altogether. The bug has not manifested for months now. However, now I’m adding a textbox control to this window, and noticed that it’s not allowing the text entry, only spaces. If I switch back to the original method, it works, but I’m afraid the issue will start showing up in production again. Has someone come across this issue before? Any advice will be greatly appreciated!

DevExpress PivotGrid (Silverlight) : Popup Menus don't popup

We are using DevExpress Silverlight PivotGrid (11.2.7). The problem is that none of the popups work as one would expect.
Here is the xaml code (note that all of these properties are True by default and don't need to be set)
<dxpg:PivotGridControl
x:Name="pivotGrid"
... data bindings ...
IsFieldValuePopupMenuEnabled="True"
IsHeaderMenuEnabled="True"
IsHeaderAreaMenuEnabled="True"
/>
Once the host control for the grid is shown and the data is loaded right-clicking on any of the relevant areas doesn't bring either of the popups (there are 3).
Strangely (or not so strangely) in the sample SL project provided by devex everything works as it should.
The one (significant) difference between the sample app and our project is that we are using MEF and relevant .xaps are loaded dynamically based on which user logged in and some other stuff.
We have tried a lot stuff to figure out what is wrong but haven't managed to find anything even remotely relevant. Here is what we have tried :
Adding the pivotgrid to the host tabpage in codebehind after imports have been satisfied;
Setting / resetting properties mentioned above after imports from codebehind;
Adding the control to the startup page of the project before the MEF madness kicks in;
We also tried to popup the menus manually by inheriting from the pivotgrid control, but that has not yielded much;
Enabled RedrawRegions to make sure the popup is not popping 'under'. It's not;
Any pointers or ideas would be greatly appreciated.
Regards,
Alex
It appears that this was some bug in the version we were using at the time.
After updating to 12.1 everything works like it should without any tinkering from our side.
Looks like devex guys have bugs too...who knew right :)

SketchFlow WP7 Navigation Buggy

I'm making a Sketchflow WP7 application which is working fine, except Navigation is sometimes buggy. Sometimes when I go to a screen and try and click it doesn't work, some times it does. I'm using the MouseLeftButtonDown Event to trigger it. After it 'freezes' I can no longer navigate via the map either, though before it freezes I can. I'm not sure if any errors are thrown because I'm not aware of a real time silverlight console. Sketchflow doesn't have a 'Debug Project' option only a 'Run Project' one.
It's very unpredictable, sometimes it works, sometimes it doesn't (though some links are more unreliable than others). Sometimes it gets stuck in different screens. I've tested this across browsers and computers and while sometimes a new browser occasionally has a better success rate, something always gets stuck.
I'm afraid I'm probably leaving out some details so feel free to ask for them. I'm not really very familiar with Silverlight and Sketchflow, I'm just working on a prototype so it seems like I shouldn't have to deal with any code based issues...
Thanks!
You might want to look for a Click Event rather than MouseButtonDown as that could be anything, it doesnt mean MouseButton Down, MouseButton Up, which resembles a click. this is just the same as if you use your finger to touch the screen, this would also trigger the MouseButton Down Eventhandler
so if I was you try and use the Click eventhandler for your navigation.
You can open the same project in VS (including the free express editions) and run it in the debugger from there to see if an exception is being thrown. That might help narrow down the problem.

Strange "frozen" content of WPF Window bug

A few of my users are experiencing a strange bug. I have a simple WPF window that contains a few textblocks and buttons. After a short time using my application successfully the users that experience the problem report that the window's content becomes empty and only the border of the window is visible.
After remoting onto their machines I have confirmed that it looks like the content of the window is frozen. When the window first opens it appears like its see through and displays whatever is behind it. If I move the window around the same frozen image of what was behind the window when it opened stays there. If I bring something in front of the Windows (such as a browser) the "frozen image" in the contents will change to a frozen image of whatever was in front of it. I have discovered that the buttons are still active and clickable in the window, so it's not completely frozen it just seems not to be drawing the content properly.
The issue only seems to affect a small percentage of my users and I cannot recreate this issue on any of my test machines. Any ideas about what is happening would be greatly appreciated.
If you have a user that's willing to experiment to find a solution, have them Disable Hardware Acceleration in WPF. If this fixes the issue, then it's most likely a graphics driver problem.

WebView containing Silverlight

In my cocoa application I have a WebView. If I set that WebView to display a web page that contains Silverlight, the mouse move event never fires in that Silverlight application (with the exception of if I hold down the mouse button while moving). Everything else seems to work fine (clicking, interacting with objects) except for mouse move. Anyone have any ideas what is causing this and how to fix it?
Found out what the problem was. When Silverlight is embedded in a WebView (from WebKit) appears to have different concerns regarding threading (Firefox on OS X does not exhibit this problem). The solution was making sure that anything that touched a UI Object was in a control.Dispatcher.BeginInvoke (specifically in my case I was changing the text on a TextBlock in response to a MouseMove and that was causing the whole MouseMove to error out).
Hope this helps someone.

Resources