I'm not certain why, but the drag drop events on an HwndHost don't seem to work (actually no events seem to work at all). I am able to hook into the windows messages going to the HwndHost, however, I can't seem to find anything of use.
I am trying to be able to drag a node from a tree-view onto an HwndHost that is hosting XNA. I set AllowDrop to true on the HwndHost, but it appears to do nothing. Does anyone know how I can enable to HwndHost to be a target of a drag/drop operation?
Thanks!
Is this behavior only when running under the debugger?
Are you running Visual Studio as administrator?
If so I recently ran into this problem. Try it without debugging, if that works you'll need to run the app then attach to it to debug the drag and drop code.
It's a security feature in Windows :/
Related
I need to debug xaml and i am looking for some application for that .
Need for recommendations.
Snoop not manages to find my application while i am trying use it.
Thanks
I've had great results with Snoop but you might want to check if you are running your app with elevated permissions eg as administrator as this will prevent it showing up in the list of applications inside Snoop - from snoop codeplex page
Why Aren’t My Apps Showing Up in the App Chooser? One question that comes
up all the time is the situation where
the application you are trying to
Snoop, isn't appearing in the
application chooser (i.e. the combo
box that lists the processes you can
Snoop). This is more than likely a
situation where the application you
are trying to Snoop is running
elevated (as Administrator). In order
to Snoop these applications, you will
also need to run Snoop elevated (as
Administrator).
Also if your xaml is Silverlight then it looks like the only options is Silverlight Spy
You can use 'Visual Tree Visualizer' from VS 10 (VS C#/VB.NET) 2010 Express. See: http://msdn.microsoft.com/en-us/library/dd409789.aspx
I am currently working on WPF touch-screen application. I am developing it on Windows XP machine. I have tested it on this machine and it works perfectly fine. But when I deploy it to Windows Embedded machine I start to get strange behaviour: all pop up messages, drop down list, context menus appear behind the main window.
I am also setting the focus on my main window, when application loads, to enable context menu on the main screen.
Also my main window's AllowTransparency is set to true, (I have seen people had similar issues when having set to AllowTransparency). And also this didn't happen in the previous release.
Edit: The issues has gone after several compilations, I was unable to reproduce it, but I am still trying.
I also think it has to be something related to graphic driver, as it happens on one windows XP machine, but not on another (hardware is different, one run XP embedded 2nd XP professional).
Any idea why this is happening?
Have you tried forcing the ZIndex of the elements to that they are higher than the main window?
This MSDN blog post describes it's use - but the important part might be:
The first set of Rectangle objects uses the default z-ordering rendering of objects, which is based on the position of the child object in the Canvas collection
So if the order the objects are created has changed (for whatever reason) you might see this behaviour.
Explicitly setting the ZIndex will confirm or deny this.
I want to create control that seems and works like the Solution Explorer of Visual Studio.
I mean not the functionality of solution explorer, the control should be seems like that control. That means, server explorer, toolbox, error List,... All these controls will pop-out when we put mouse and pop-in when we leave. We can lock and unlock those controls also.
So can anyone help me, to get the solution for this problem.
Thanks!!!!!!!!!!!
I am assuming you are using C#/VB.NET for development. The dockpanel suite will provide a docking framework for an application. Basically in terms of dockpanel, it is the forms which can be docked on the application using drag and drop like visual studio.
So create a treeview control in the form and dock it to the parent. You can populate the treeview control based on file directories or any specific needs of your project. Please note in dockpanel you create a form by not inheriting from Form class but from DockContent class. Documentation will give you more insight of how to create applications. It has a good example along with the source code in which it simulates the all the visual studio panes. It also provides and option to save the position of various docks which can act as a user preference. For eg, you may like to position solution explorer on left side whereas i may want it on right side. this get stored in a conf file which gets read next time when you start the application.
Incase you using MFC, then visual studio 2008 SP1 provides you with docking framwork and within that use the treeview control.
XAML also provides a docking framework. But i am not sure, you need to verify.
Win32 API does not have any native docking framework.
I have a strange problem here. I've created a simple plugin using the wizard for a Visual Studio Integration Package / VSIX project with a tool window. Within that window I want to do a simple drag/drop from a listbox and drop within the same window. I've done the same thing in a normal WPF program, but when I do this in a WS toolwindow it's not allowed. I start the drag/drop operation (initiated by a PreviewMouseLeftButtonDown event) and call the DragDrop.DoDragDrop() method, I get the stop-sign-cursor at once. No dragging allowed.
Any ideas? Security restrictions or an effect of the fact that these WPF controls are hosted inside a ToolWindowPane and old Visual Studio IDE COM stuff I guess... Thanks for any help!
Alin Constantin at Microsoft helped me out here and has even written a blog post on how to do drag/drop within VS2010 properly!
http://alinconstantin.blogspot.com/2010/02/drag-and-drop-in-visual-studio-2010.html
Highlights, in case of link rot:
In your tool window (the UserControl), override OnDragEnter, OnDragOver (important!) and OnDrop. Failure to override OnDragOver will cause drag/drop to fail.
In OnDragEnter, do the following:
Check to see if you can handle the drop
If so, set DragEventArgs.Handled to true and DragEventArgs.Effects to the appropriate value
Call base.OnDragEnter()
In OnDragOver, you must do the same thing as OnDragEnter. If you fail to set Handled, Visual Studio will take over and you won't be able to handle the drop!
In OnDrop,
Handle the drop
Set DragEventArgs.Handled to true
Call base.OnDrop()
Remember, not handling OnDragOver will result in Visual Studio taking over the drag operation, denying you the ability to handle it in OnDrop.
I'm working on a solution that contains multiple projects targeting Windows Mobile 5 and standard Windows applications.
Lately when opening up a form in designer the common UI controls (textbox, button, label, etc etc...) have vanished leaving only the controls defined within the project.
Resetting the toolbox has no effect. A google search suggested deleting the toolbox temp files in the Local Settings\Application Data\Microsoft\VisualStudio\9.0, however this was only successful in bringing back the default controls for Windows Mobile 5. The WinForms controls are still mysteriously missing.
Also, if I right-click and Select All on the toolbox, all of the WinForms controls do in fact come up, however they're all grayed out.
Has anyone else experienced this?
I just had a similiar problem. In a managed C++ project all the default toolbox items disappeared form the winforms designer. After playing around for a while I found that there was a problem in the .vcproj file.
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="COLLADA Import"
ProjectGUID="{0DEEF9B6-1929-44E3-92EC-13712839FB63}"
RootNamespace="COLLADAImport"
Keyword="ManagedCProj"
TargetFrameworkVersion="0"
>
When you set TargetFrameworkVersion to a valid number, for example 131072 for .Net 2.0, the toolbox items will be back.
If you right click on the Toolbox and select 'Choose Items...' and then sort by the 'Namespace' column, you can then select the ones you need (for example System.Windows.Forms for WinForms).
You can multiselect with Shift and then select/deselect the group.
The controls then reappear in the Toolbox as enabled.
I've noticed this exact same thing for regular WinForms as well. I can't speak to mobile applications but in regular winforms this has a tendency to happen.
I believe it's actually a bug in Visual Studio.
There are some things you can do (again, for WinForms. I'm not sure about mobile) with adding attributes to your control. Such as:
[ToolboxBitmap(typeof(MyControl), "MyControlBitmap")]
There are some other useful related things on this site:
http://en.csharp-online.net/Design-Time_Integration-Attributes
I had exactly the same problem (after installing Windows Mobile SDK all items in the toolbox were greyed out).
I've startet the Visual Studio 2008 command line as administrator and started the following command (WARNING - all your settings are lost !!)
devenv /setup /resetuserdata /selfreg /resetskippkgs
After that the toolbox looked fine and worked like on the first day.
The idea came from this thread: connect.microsoft.com
Go to the Tools menu and choose import & export settings, then choose the 'reset all' setting, then yes. Save your current settings, after that you'll have your toolbox reappear.
Actually you may be able to add a registry key to get this to work also.
Make sure you're not in Debug mode.
If you are running Visual Studio 2008 under vista, try running it as an Administrator. Right click on the shortcut and select Run as Administrator.
Well guess what install Service pack 1 for VS 2008 and it would go away and if you have wireless mouse and keyboard turn it off. Choose one of these two both work.