VS 2017, WPF
I have a WPF project in which several self made User Controls are defined.
On a window, I have added these controls directly on the window grid as well as on grids on tab items of a tab control.
The project compiles and runs fine.
There are no errors in the XAML view or designer view of the User Controls.
There are no errors in the XAML view of the window.
Here is my problem:
in the designer view of the window, all my User Controls get the yellow triangle warning sign.
How can I find out what these warnings mean and why they are there ?
Related
In my VSTO projects (Office 2007 / 2010) I would like to use a small popup control (think Tooltip like features; fade animation and mouse interaction).
I would prefer to use WPF. If I were to do this in WPF I would create a custom Popup Control.
In VSTO, as far as I understand it, I must use a WPF window and then have 2 options, either I put this window in a Windows Form Container or I get the Hwnd of my office app and I add this Hwnd to the Owner property of a WPF Window. Am I correct here?
Creating a whole window, animating it on and off the screen etc to look like a ToolTip seems to be overkill.
So my question is how should I do this. I would prefer WPF.
I don't know if this would work but my first thought is to build a very tiny WPF window which is transparent and start it with the Office App. I can then build a Popup Control (which is a child of this tiny window) which I show and not show at a mouse position. Pretty sure a popup can appear outside the bounds of its parent window.
Just wanted to tidy up my own question with what I did. In the VSTO addin project I added a reference to WindowsBase, PresentationFramework and presentation core.
And then I just follow any tutorial or example that adds a WPF Popup. By popup I mean a System.Windows.Controls.Primitives.Popup. For the Placement I used PlacementMode.Absolute and then used a window point to set its position.
This pretty much answers my question. Of course this popup is literally floating above your office window so you will need to make sure that you control it for example if the office window moves, is minimized and the like.
I created a UI by dragging and dropping controls from the toolbox in Visual Studio and got the following as I expected.
And then I modified the XAML to embedded within a proper grid hierarchy. Now all the controls except the menu are not visible in the UI. But I can still select them in the designer as below.
How can I resolve this?
When the WPF window is opened in design view in Visual Studio, the Toolbox pane automatically loads WPF controls into "Common WPF Controls" tab and "All WPF Controls" tab.
Does anyone know how Visual Studio does this?
Seems like they would be loaded through either the Project References or the (more likely) user options saved when you rightclick on the tookbox and choose "Choose Items...".
I would imagine that somewhere, there is a setting where by default when a XAML page is open, it loads a bunch of items in System.Windows.Controls into the Toolbox. If you want, you can deselect those items you dont want, and put different items in the toolbox
how do we get the datagrid control in wpf visual studio 2010....I mean how to add the datagrid control to the wpf default controls..if I directly type tag in my xaml code, it's giving an error to check the reference assembly that needs to be added..
could anyone please help me out to resolve it...
You can find it at the Common WPF Controls section in your Toolbox as you can see below. Just drag-and-drop it into your window designer and everything will be okay:
Update
Then do the following steps:
Right click on your Toolbox and click on Choose Items...
Filter the long list on the opened form by typing DataGrid as you can see on the image below:
I create a simple WPF UserControl (any control will do) and insert it into a Winform (using an ElementHost).
This works fine. The WPF control is embedded in the WinForm and when the WinForm is moved around the WPF control moves with it just like a WinForm control will do.
When I change the WinForm to transparent by setting the TranparencyKey to the same value as the BackColor some problems occur:
- The WPF control is not displayed - instead a black rectangle is displayed in its place..
- If the WinForm is moved around the screen then on its original place the WPF control appears - as if it was covered by the WinForm.
Changing properties of the ElementHost (such as BackColorTransparent) did not change the behavior.
Setting both the BackColor and the TransparencyKey of the WinForm to Black got rid of the black rectangle problem but still when the WinForm was moved the WPF control was left in the original place.
Note also that these problems occurs under Windows XP SP3 (which is our target OS) but not on Windows 2003.
(We did not check on Vista and Windows 7).
Any ideas how to have a transparent Winform with a WPF control inside and still get a normal behavior?
Did you set the background property on the WPF control? By default it inherits from it's parent container and if it's not present it will do this. Try setting the background property on the UserControl to white or grey and your problem should go away.