Is it possible to add definition of WPF Custom Control to dll?
There is no such a template in Visual Studio 2015. Only template "WPF User Control" is avaiable, but I don't want to create control from scratch but modernize existing standard control.
The following project types exist that might fit your needs:
WPF Custom Control Library: Custom controls extend one of the WPF control base classes and provide additional functionality through code.
WPF User Control Library: A user control is technically a normal content control which you can extend in some parts in the code but usually it is extended by placing other controls inside of it.
See this answer for more information: What is the difference between a User Control Library and a Custom Control Library?
If I understand you correct, you want to create a User Control based on XAML. In my Visual Studio, this template is called "User Control WPF" and yes, you can add it to a Dll.
To modernize an existing control it might be simple to modifiy the style and ControlTemplate of this control. You can extract style and control template using Blend and then modify it to your needs.
Related
Is there a way to use visual studio design-time Properties Window at runtime to customize a specific Control such as DataGridView?
Some thing like image below needed to enable user to customize controls on a Form by changing properties of them.
The PropertyGrid is a standard control. You can add one to your Form or create it at run-time.
In the ToolBox, it's usually found in the All Windows Forms cathegory, or using the search tool.
It can be fully customized and supports transparent colors.
You can use the SelectedObject property to associate it to an existing control and it will populate automatically (this property can also be set at design-time).
The PropertyGrid can then be used to change the associated control's properties at run-time.
propertyGrid1.SelectedObject = this.dataGridView1;
I would like to use a custom font for a Label in my WinForms project without installing the font. I found this as a solution, however it does not work since the FontStyle I want to use is Thin, which is not included in the System.Drawing.FontStyle enumerator.
Since I read instead that it should be quite easy in WPF to use such a custom font, I thought that a possible solution is to create a custom label (ThinLabel) in WPF and to host it in Winforms. Can you please instruct me on which is the proper way to create a custom label in WPF for this purpose? I read that in WPF controls can be customized in several ways (Styles, Data Templates,..) but I've no idea of which should be taken for this purpose. Please consider I've never used WPF so far.
In Order to implement WPF UserControls in Winforms you need to use and ElementHost
So if you want to create an WPF Label like you said in WPF you create a DLL project with your label inside it and reference it in your winforms project, after building you should be able to see a the UserControl with the label in the toolbox if not use an ElementHost
I am new to the concept of custom controls, and until recently my experience has been limited to extending controls that already exists.
In Visual Studio, how do I add support for my custom controls in the form of Designer Drop Downs and forms?
This picture below identifies the kind of components I am wishing to create for my custom controls.
I'd recommend reading Extending Design Support on MSDN. In this case, you want a custom designer for your type, which can be specified via the DesignerAttribute decorating the type. For details, see Custom Designers.
I am currently in the process of improving my options dialog for a winforms application. At the moment I am using a tab control.
I would like to create a form/dialog for settings that is similar to Visual Studio's. How is this done? I can see a treeview like control on the left hand side but what control are they using to display each of the options pages, it doesn't appear to be a tab control. I would like to be able to build the controls for each of the settings at design time.
Thanks.
They look to me like UserControls. I can't say how exactly they implement it, but it would be simple enough to build a UserControl for each option type and swap out the current control when the tree view selection changes. In your designer you would simply have the TreeView and a parent panel to host the UserControls. At runtime you would perform the swap.
Is it possible to have a single project which allow to include a custom custom control within another custom control ?
Update: of course I'm not asking about how to put a custom control on a winform!!! But if I can create put a CUSTOM user CONTROL inside ANOTHER CUSTOM user CONTROL within the SAME PROJECT.
Sure, you're able to do this. In fact you're able to put a custom control inside another custom control the same way you'd do it on a form (it's essentially the same while editing). You might as well base your custom control off another class (or custom control), but not all will support the built in gui editor (so you might just see an error message but the code will still work).