Click here to Skip to main content
15,892,281 members
Articles / Programming Languages / C# 4.0

WPF Control Composition (Part 1 of 2)

Rate me:
Please Sign up or sign in to vote.
4.94/5 (9 votes)
16 Mar 2012CPOL7 min read 42.5K   2K   36  
Composing controls in a user control improves the consistency of a resulting application but does not add much extra work or complexity.
StyleCop
--------

I use StyleCop in my projects to make the code readable in a uniform way.
So, if you should get an error when compiling the project, you can either
download and install StyleCop, or edit/remove the corresponding entries in
each .csproj file:

<Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.7\StyleCop.Targets" />


Simple Controls (Version 1)
---------------------------

This version of the Simple Controls project contains a WPF control collection of:

- A Combobox with label
- A Combobox and Textbox with label
- A Watermark textbox with label

Introduction
------------

The project shows how the above components can be
arranged with label without having to declare each label
each time the control is needed.

Just declaring the control and setting the dependency
property in XAML is all that is needed to arrive at a simple
standard layout.


RESTRICTION
-----------
Controls in this project cannot be themed. Please refer to Version 2 if you are
looking for skinable WPF control samples.

See

http://www.codeproject.com/Articles/332539/WPFControlCompositionPart1of2
http://www.codeproject.com/Articles/332541/WPFControlCompositionPart2of2

for more details.

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Germany Germany
The Windows Presentation Foundation (WPF) and C# are among my favorites and so I developed Edi

and a few other projects on GitHub. I am normally an algorithms and structure type but WPF has such interesting UI sides that I cannot help myself but get into it.

https://de.linkedin.com/in/dirkbahle

Comments and Discussions