In Ms Word I'm trying to add TaskPane with WPF controls.
I know that I have to add host winforms control to taskpane and later add wpf contorls to this host.
Its works for me and everythig works.
But when I want to properly add pretty wpf control using resource dictrionary I cant, bacause there isnt't resource dictrionary on list to add from "Add->New Item..." menu.
There is no problem with other wpf projects, but in VSTO I can't.
Checked on Visual Studio 2019 and 2022.
Using search on this window don't find proper resource template.
What am I doing wrong?
Or maybe it's not VSTO's fault but something completely different?
It's not the most elegant way to get around this but at least it's a way around:
Add a user control to your folder
Open the XAML and remove all the user control references and make it look like below
< ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
< /ResourceDictionary>
go to solution explorer and expand the subfiles in the XAML that you want as a resource and delete the .cs
how to delete the folder
Hope this helps
Related
Is there any way to add components in a drag and drop fashion?
Here is what my environment currently looks like:
Right now I can only modify what my window looks like through xml, which is undesirable. Is there anyway to drag and drop buttons and stuff?
Right click the file, -> Open with... -> pick XAML UI Designer, and check Set as Default.
You selected the XML Editor as the default for this file type previously, so things like shift+F7 to change to design view aren't available. Changing the default back will fix this.
Yes. Visual studio comes with Expression for VS, a built-in XAML Editor:
Check your settings when you open the XAML. Make sure you are using "Automatic Editor Selector (XML)" which should default to the XAML UI Editor
Yes, of course. I don't know why there's not a UI tab in the screenshot you posted, but pressing Shift-F7 should swap you to the designer UI. If not, a quick web search for "xaml designer" should point you in the right direction. There's also Expression Blend, which is a more robust tool for designing XAML styles and controls. Once you reach a moderate level of complexity, you'll probably start using Blend or hand-editing your XAML more than using the designer.
I have problems to use the Extended WPF Toolkit controls in the XAML designer
environmet: Win8.1, WPF Toolkit 2.1.0.0, MS VisualStudio Express 2013
What have I done?
- Downlod the actual "Extended WPF Toolkit Binaries" from Codeplex-Homepage, unzip....
- include the Xceed.Wpf.Toolkit in my project - referencies ( o.k )
- in Toolbox: Add a new Tab "WPF Toolkit Extended" ( o.k )
- in the new registercard: Add Items. I see all the about 70 customs controls (ex. SingleUpDown and so on) (o.k)
- I try to drag and drop a custom (ex. SingleUpDown) to my main window. DOESN'T WORK
I get a messagebox (in german, I try to translate)
" a reference "XCeed.WPF.Toolkit, Version 2.1.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4" was added to the project. Press OK to restart the XAML Designer, that you can use the new types / controls out of the new referencies. After restart of the XAML designer you should do it again.
When I restart the Designer, or VisualStudio or even the computer, its always the same message. And I do not see the reference to the toolkit in the XAML designer.
I surely also tried all the referencies and hints on the codeplex installation site:
Add a using statement ("using Xceed.Wpf.Toolkit;") to the top of .cs files
Add a new xmlns (for example, xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit") to the top of XAML files
In your XAML, use the namespace prefix (in the above example, )
But this also doesn't work.
Is there any idea, why I am not able to drag and drop the controls to my main window and what is wrong in my approach. (I am pretty new to C# and WPF)
SORRY SORRY SORRY SORRY SORRY SORRY SORRY SORRY SORRY SORRY SORRY SORRY
I just solved it by additional google search. problem is to unblock properties after DLL-Downloads. My salvation was this comment:
This is a common problem when downloading files from thw web. Simply go to the folder where you downloaded the DLL. Right-click the DLL and select properties. Near the bottom of the properties dialog there should be a button that says "Unblock". Click that and you should be good to go.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I think the best solution is to add the WPF toolkit via Nuget.
If you don't have nuget already installed, go to Tools -> Extension and Updates in Visual studio. On the online section you should find Nuget easily it always appear on top, then click "download"
Once Nuget installed, right click on your project in the solution viewer and click on "Manage NuGet packages"
In the menu search for the Wpf Toolkit, and click on "install"
This way you are sure that the library is added correctly.
Having the same project opened in both, Visual Studio and Blend, I use the former to write code while I edit the XAML in the latter.
When I add an UI element to the .xaml file and save it in Blend, if I have that file opened in Visual Studio too, I see the message that some external changes have been done and asking if I want them to take effect in the opened file*. I accept it, and I can see the changes take effect in the .xaml file in Visual Studio.
The problem is, that although the new elements have been added to the .xaml file, I'm not able to access them throug Intellisense in the code-behind .cs file.
For example if I add following element to the MainPage.xaml using Blend:
<Button x:Name="MyButton" Content="Button"/>
I can see that same line added to the page in Visual Studio, but I cannot access it using the name MyButton in MainPage.xaml.cs file. Intellisense is not working for it. If I write, for example MyButton.Content = "Hello!"; it is red underlined, however I can build and run the project.
Rebuilding the project doesn't do the trick, and Intellisense doesn't work until I save the file "again" in Visual Studio.
I feel this behavior annoying sometimes, and I'd like to know if it is the normal behavior, or there is something wrong in my configuration.
*I usually don't have it opened in Visual Studio, just to avoid that meessage being shown for each modification in Blend
I have just check your problem actually it is not a issue. everything is fine so what you have to do is save your xaml page on which you have added the button after accepting the changes that was done in blend..(do control + s on your xaml page one more time it will work fine)..sorry for my bad english..
I encountered this issue when developing Xamarin Forms in Visual Studio 2015 and somehow the problem went away after I:
1) Unload project (right-click project and select from context menu)
2) Edit .csproj (from context menu)
3) Pretend to modify and save csproj. :)
4) Reload project (from context menu)
Closing the whole solution and re opening it fix my similar issue.
I am new to MVVM therefore I understand this is a beginner question but I have not found the answer so far.
But in the View project of a MVVM style, what are the steps to add a XAML file to the project. When the project is selected in the solutions Explorer and Add ->Item is selected then how do you make sure that a XAML file is added. or there is no magical way to do it and you just add a .CS file and then change the extention to XAML.
Thanks for any help or references to any URLs.
Just right click the project, choose Add -> Window and that will add a new xaml file along with its corresponding .cs file.
When I want to create a style file to be used on more than one Window I Add a "WPF/Resource Dictionary" and add it to the Window.Resources of the windows that will use it. Something like this below. Everything you want to put within the Window.Resources should be placed between the ResourceDictionary tags.
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary Source="scrollerDictionary.xaml"/>
</ResourceDictionary>
</Window.Resources>
This works for me (VS 2022)
Right-click project or use Project menu then click
Add
-New Item (or Add New Item)
Choose the "Blank Page" and enter the name of the Window you will be adding,
eg name.xaml
Then Click Add (bottom right). Both the .xaml and the associated .cs should appear
For me selecting the .xaml file is VS2022 solution explorer, viewing Properties, then changing the Build Action from "None" to "Page" resolved the issue.
This works for me, copy the template into the folder for the user:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Xamarin\Xamarin\4.0.3.214\T\IT\Cross-Platform\Code
to
C:\Users\your name here\Documents\Visual Studio 2015\Templates\ItemTemplates\Visual C#
Original answer: http://damianblog.com/2016/04/08/vs2015-xaml-forms-xaml-missing/
I made a User Control and already was able to use it by adding it to a form in the C# code. The User Control is in the same VS2005 Project as the main form.
The problem is that I can't see the User Control in the gui editor ([Design] window) with this implementation. I tried many things but I wasn't able to add the user control to the real form desing.
I read some things about making a control lib dll and then add this dll to the toolbox but I don't want to have an additional project and an additional binary file.
How can I use a User Control in an form Design, if both are in the same VS Project? I think somehow this should be possible?
Edit 1:
Sorry I have Visual Studio 2005 not 2010
It's certainly possible to use a UserControl in design mode when it's part of the same project.
Do note, however, that it will only show up in your toolbox if you have enabled the "AutoToolboxPopulate" setting. Go to the "Tools" menu and select "Options". Expand "Windows Forms Designer", and click on "General". Make sure that the "AutoToolboxPopulate" property is set to True. When you rebuild your solution, your UserControl should show up at the top of your toolbox, ready to add to your form.
Alternatively, you can add the UserControl to your toolbox manually. To do that, right-click on your toolbox and select "Choose Items" from the context menu. Navigate to your control, ensure that it is checked in the list, and click "OK".
In the event that an exception is thrown (like MacX mentioned), you will still be notified by the designer. The control will still show up in the toolbox, and you'll still be able to attempt to add it to your form.
As APShredder already mentioned the control should automatically appear in the toolbox. If it doesn't check your Visual Studio Settings:
Tools - Options - Windows Forms Designer - General - AutoToolboxPopulate - True
For further informations just read the Walkthrough in the MSDN.
You should be able to use a custom User Control in the Winforms designer. You have to build your project first however. You can do this by going to Build --> Build Solution or by pressing F6. Then your control should appear in the Toolbox.
Yes, in the toolbox, right-click and choose "Choose items...". Then navigate to the ".NET Framework Components" - your controls should be listed in there. Just choose to add them.
There should be no Problem with the Control, except you have an exception which is thrown within the constructor or the Load-Event. The the Designer is not able to display the control correctly.
In VS2010 after you create a User Control and compiled it, VS add automatically your component and make it visibile in his namespace on ToolBar.
This can be done in Both WPF and old style code/Components...