WPF: Themes and how they can be used - c#

I've just purchased the Telerik UI components for WPF and after installation it has created a distinct Telerik C# WPF project type in the Visual Studio (2013). After selecting that project template a wizard pops up and after I complete it I see a Themes folder is added to my project where there is many .xaml files like System.Window.xaml.
I know that these files may be reusable themes that can style my windows but the problem is that it is the first time that I'm comming across such files. So I have two questions:
1- What exactly are these files?
2- If they are reusable styles, how can I use them. Like but adding the whole style to an empty window.
for example if I use the Office theme, does my app automatically look like MS Office ?

Please read these documentations from Telerik:
http://docs.telerik.com/devtools/wpf/styling-and-appearance/styling-apperance-implicit-styles-overview.html
http://docs.telerik.com/devtools/wpf/styling-and-appearance/styling-apperance-themes-runtime.html
http://docs.telerik.com/devtools/wpf/styling-and-appearance/stylemanager/common-styling-apperance-setting-theme-wpf.html

Related

XCeed WPF Toolkit -use Controls on 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.

Add Visual Studio solution to existing solution in Visual Studio

I wrote an application in Visual Studio C# 2010, that I would like to import into another existing Visual Studio C# 2010 Application. How would I go about doing this?
For instance, I'd like to import the project into another, and basically copy/paste the interface from the application into a tabpage on a tab control I have.
Any assistance or advice on how to do this is greatly appreciated!
You should be able to copy the physical files using windows from the existing solution location to the new solution location.
Then once the copy is complete open Visual studio and tell it you want to add an existing project. Navigate to the folder where the files are on the filesystem and open the project file.
Once you save the solution it should from that point forward have the new projects in the new solution.
There are several ways to achieve this - Copy & Paste being one of them (but the least beautiful of course). A more promising one is the following:
Wrap the user interface you want to share in a User Control in the existing project. Also include the code behind logic in this user control. Include the user control in the project and make sure that everything works before continuing.
Add the existing project to the new solution. It is advised that you create a hierarchical structure in the file system for the solution so that all projects in the solution are located under a directory.
Reference the project from the project that wants to access the user interface. As the projects are in the same solution, you can add a project reference. This asserts that the projects are built together.
Place the user control on the tab page.
As an alternative, you can also pass on adding the project to the solution but only create a user control and add a binary reference from the other project.

Add-in for Visual Studio for project file editing (csproj)

Do you know an add-in for visual studio which adds properties for C# projects?
csproj file format is very powerful but only small amount of options can be changed through the standard properties page. For instance, I want to have several configurations and each of them should include it's own references. Or I just want to change the type of project from winforms to wpf or other one. In order to do stuff like that developer has to edit csproj by hands in text editor instead of using properties.
If you know that such add-in doesn't exist, do you think that it could be popular on codeplex? or only small amount of developers realy need it? what is your opinion?
How is it going?
To edit project files inside of Visual Studio I use PowerCommands, but those things you can change "using properties" are those in Project Menu -> [Project Name] Properties. What PowerCommands does (among other things...) is allow you to easily edit the XML of a project opened inside Visual Studio so you get all the benefits of using Visual Studio to edit XML. Makes sense?
XML is hierarchical, so hardly you can fit it comfortably on a property list better than on a text editor.
About "I want to have several configurations and each of them should include it's own references", try creating templates for your projects, take a look there: Visual Studio Templates.
So... you are looking for addins at codeplex? why not take a look at http://visualstudiogallery.msdn.microsoft.com there are free and paid addins, an some form codeplex too. While you are on it, look for "Productivity Power Tools", "VSCommands 2010", "AllMargins" and "VS10x Code Map". I use them all, and they are certainly worth a look. [Hmmm... I also use CodeRush, you can get CodeRush Xpress for free from http://www.devexpress.com ;)]
Hope of being of help.
A little late to the table but I wanted to remove VSCommands 2010 because all I use it for really is the edit project file and I don't like to just have extensions hanging around if I am not using them. I discovered from this blog:
http://blogs.msdn.com/b/habibh/archive/2009/07/01/the-quickest-way-to-edit-a-visual-studio-project-file.aspx
"There is a quick and easy way of editing your Visual Studio project file. When a project is "unloaded", either because you explicitly chose to unload the project using the "Unload Project" command or Visual Studio failed to load the project for some reason (e.g. project upgrade failed), you can right click on the project in Solution Explorer and select the "Edit " command, as shown below."
It works like a charm!

Any way to modify existing files in a Visual Studio Template?

I'm currently using a "New Item" template of mine to create several classes in my project based on the Name entered. What I'd like to be able to do, is to also add some lines to an existing file in the project. Is there any way to do this? Is there any way to run some sort of script from within the .vstemplate file?
For a vanilla item template in Visual Studio there is no way to achieve this. Item and Project templates just allow you to add new files to a project and allow for customizations of those files. But it's not possible to use them to change existing files.
You may be able to achieve what you're looking for though with a template wizard. This allows for the execution of arbitrary code during the processing of a template. You should be able to modify the existing files to your delight with this.
Tutorial Link: https://web.archive.org/web/20090625145715/http://blogs.msdn.com/vsxfaq/archive/2008/06/12/how-to-create-a-custom-template-wizard-using-visual-studio-2005.aspx
EDIT: Sorry, I misunderstood the question.
Original answer:
Well, the default templates are in 2 places:
\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplatesCache\CSharp\1033
\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates\CSharp\1033
You can change the template contents for new classes and new forms in there at your leisure... Not sure where user created templates are saved, but there's no reason you couldn't do the same thing to those (to my knowledge.)

Visual Studio - Programmatically configure solution for source control

I am in the process of creating a Wizard to help my organization auto create a base project for all applications. The idea is that a programmer can enter a project name, a few other basics and the process will create some projects, add other project from source control, configure IIS, etc...
A lot of the work is done by simply using project templates and the IWizard interface for some of the more complicated operations. What I am trying to do is this, once all of the projects are auto created, I am creating a workspace and automatically moving all of the files under source control. I am also doing things like adding common projects, setting up some special settings in IIS, etc... The problem is that the solution file, although it is under source control, is not actually configured to use source control.
Anyone have an idea on how to programmatically configure a solution so that it is part of source control and ready to use? I've run into a brick wall and can't seem to get any further. BTW: In case a didn't make it clear, I'm essentially trying to do the same in code as right clicking on a project and selecting "Add Solution to Source Control."
Like I've said, I've got most of the issues solved. Just this last one is giving me fits...
The important facts:
Windows XP
VS 2008
TFS
Using Microsoft.TeamFoundation objects....
Can you handle this through the Visual Studio extensibility framework? EnvDTE basically provides access to anything you can do interactively...
I just did what you said while recording a Macro; Looks like:
DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate()
DTE.ActiveWindow.Object.GetItem("CLSTestSolution").Select(vsUISelectionType.vsUISelectionTypeSelect)
DTE.ExecuteCommand("File.TfsAddSolutionToSourceControl")
Perhaps you can start there?

Categories