This project is read-only.
10/7/2014 - I've successfully used this library to build a couple small WPF tools. The only thing I found missing so far is a native FileDialog built in WPF-CPS. Therefore, I may build one in the Contrib project.

"If WPF via XAML and MVVM is heavyweight like EntityFramework is; then, maybe, WPF-CPS is like the LINQ-to-SQL of WPF Development? Nimble and lightweight, even if limited!" --Anonymous

WPF Composites (WPF-CPS) may enable a Rapid-Application-Development (RAD) approach to building Fluent WPF desktop applications and/or Windows Store Desktop Apps for Windows 8*?

Windows Desktop Apps may likely continue to be superior for synchronous, enterprise and content creation apps. In counterpoint, touch-first, Modern UI WinRT apps may best serve the arena of asynchronous, individual consumer and content consumption apps. There may, indeed, be a place for Desktop apps ongoing after all?

WPF-CPS provides an alternative, concise, C# (or IronPython or F#) code-behind approach to managing WPF UI Framework Element composites. WPF Composites are normally managed via XAML and DataTemplates but this library uses ID's and X-Y Coordinates instead to position elements on the screen. This is currently for synchronous apps only. It is not designed to be thread-safe. I welcome volunteers!

It works via 100% code-behind, zero XAML, has CSS-like Selectors, has Generators to generate multiple Framework Elements based on a single Prototype Element's properties (e.g. create a button and automatically clone it 5 times), and supports 26 different WPF controls. Just added sorting to the panels too to allow sorting Grid, StackPanel, DockPanel, WrapPanel, TreeView, and DataGrid.

It contains four child namespaces: Observables, Selectors, Generators, and Dialogs.
These all reside within the comprehensive FasterWPF parent namespace.

* I haven't actually submitted a desktop app to the Windows Store using WPF Composites. I can't vouch for whether an app created with this library would readily pass or fail the stringent Windows App Certification Requirements. I am not liable for any success or failure in attempting to get your app certified. Certification details:

Address Book Demo - Desktop Application

Below is a screenshot of a full-featured demo desktop application that I wrote in F# leveraging WPF-CPS:


Feel free to try out this demo application (at your own risk, of course) here:
Address Book Demo
Address Book Demo Source Code

WPF Composites Contrib
I recently added a supporting project to WPF Composites (WPF-CPS) to allow exploring/building out new controls and techniques which leverage this existing code library.
The first contribution is an experimental Squares Navigator, a kind of data visualization control similar to paging. Each square represents 1/400th of a very large dataset. In this example, I leverage a dataset of around 39,000 mutual fund records provided by the SEC for free at here:
The second contribution is a rudimentary Paging Control for a DataGrid. I recently added Page Recycling to this example so that the Paging Control can now likely handle a few hundred records per page with relative ease. Therefore, a total dataset of 3500 records would likely be quite manageable.


C# Demo App Screenshots, also Hello World
Iron Python Example
F Sharp Example

Tutorials and Details
Easy as 1-2-3-4-5
How-To Examples
Implementing IParent
Implementing IComposite
Group Descriptions
Cascading ListBox
Visual State Manager
WPF Databinding, INotifyPropertyChanged, and Dependency Properties
Attached Properties
Print Helper
Image Flipper

The Four Namespaces
Rx Observables
Generators (Prototypes)

Pros and Cons
To-Do List
Status Update
Port to Silverlight
Memory Profile
Known Issues


Below is an example for creating a new composite, adding a new Rectangle to the composite, followed by adding two Textblocks underneath the Rectangle (all in column 0 if using a Grid Composite):

                .AddAnything<Rectangle, DockPanel>(0,0)
                .AddText(1,0, "Hello World 1")
                .AddText(2,0, "This is text at Row 2 Column 0 in the composite")
                .EndComposite(new DockArgs(Dock.Left));
- The entire composite is then added to myDockPanel at Dock.Left.
- myDockPanel is an IParent.
- IComposites are added to IParent controls.
- IComposites are containers for Child elements.

Typically, objects retrieved from or saved to a SQL database will have a record ID associated with them, either a GUID or a basic IDENTITY number (1-...). It follows then that composites of UI Elements on the screen may also be associated with such an ID. However, a GUID is not required as one can be created by the library automatically behind the scenes.

This use of ID's works well for binding and retrieving sets of UI Elements. Within a single composite tied to an ID, identify X-Y Coordinates for positioning child elements within a parent container.


Each "composite" is wrapped in a Border. This is always the top-level Type of the composite. In this way, the Border may play a versatile role similar to the DIV tag on the web?

The different container types are added at the end of a ContentControl. This ContentControl is wrapped in a Border:
Besides BeginComposite...EndComposite, there is also BeginSettings...EndSettings which should be defined first. These settings are stored and then applied to each item (either by Type or based on X-Y position) when BeginComposite is called. There is also support for subscribing/unsubscribing events.


Currently, I support multiple containers (each implementing IComposite):
public enum ContainerType
     HorizontalPanel = 0,
     Grid = 1,
     WrapPanel = 2,
     DockPanel = 3,
     VerticalPanel = 4,
     ContentControlPanel = 5,
     Canvas = 6,
     UniformGrid = 7

//Define the container to use upon initializing an IParent
myDockPanel.Initialize(100, 100, ContainerType.Grid, . . . 
The X-Y Coordinate obviously ties to Rows and Columns when using a container type of Grid, but here is a full breakdown for all the different IComposites:

Grid: x-y maps to row-column
HorizontalPanel, VerticalPanel, WrapPanel, UniformGrid; x is ignored (should be 0), y maps to index of Children
DockPanel: x maps to the Dock enum by int: Left = 0, Top = 1, Right = 2, Bottom = 3; y maps to index of Children
ContentControlPanel: there is only one x-y and that is 0,0 for the single Child
Canvas: x maps to distance from Top, and y maps to distance from Left.
Remember that x-y coordinates must be unique per child item; i.e., you can't have two items share the same x-y coordinate since this is used as a unique key to store and retrieve by.


Here is a breakdown of several common Composite scenarios. It can occasionally be confusing to think about how to nest complex Composites or build up chains of IParents and Composites. Hopefully, this may be a helpful guide:


I started with a working example of this code-behind approach via extensions to the WPF ListBox. I used extension methods because I didn't want developers to have to implement new custom controls.
This humble start has grown into fair support for 26 IParent controls:

Code Examples
Examples for all of these exist in the Demo App. Completion of the documentation here is pending . . .
1. Grid Example
2. Menu Example
3. ListBox Example
4. Combo Example
5. ScrollViewer Example
6. Dock Panel Example
7. StackPanel Example
8. Wrap Panel Example
9. GroupBox Example
10. DialogBox (Border) Example
11. TabControl Example
12. Tree View Example
13. Window Example
14. DataGrid
15. Canvas Example
16. Expander
17. CheckBox Example
18. RadioButton Example
19. AdornerDecorator Example (Field Validation)
20. ToolBarTray and ToolBar Example
21. ContentControl3D
22. UserControl Example
23. ListView Example
24. Button Example
25. ContentControl Example
26. Popup Example

IScrollViewerStrategy Examples
1. TextBox (Multi-Line) Example
2. RichTextBox Example

Other Compatible Controls Examples by Xceed
1. Extended WPF Toolkit™ Community Edition DataGrid
2. Extended WPF Toolkit™ Community Edition DecimalUpDown (aka NumericTextBox for Currency and %)
3. Extended WPF Toolkit™ Community Edition MaskedTextBox (For fixed-length formatted strings such as phone number or social security number)
4. Extended WPF Toolkit™ Community Edition MultiLineTextEditor
5. System.Windows.Controls.TextBox
6. System.Windows.Controls.DatePicker
7. System.Windows.Forms.DataVisualization.Charting.Chart
8. TextBlock and Label
9. Images
10. Context Menu Example

Supported Controls
These controls are official IParents.


Other Compatible Controls

These controls are NOT official IParents but they may not need to be; e.g., if a control is more atomic. Below are controls that are such compatible controls that are showcased in examples in the Demo App:

1. Extended WPF Toolkit™ Community Edition DataGrid offered open-source by Xceed
2. Extended WPF Toolkit™ Community Edition DecimalUpDown (Format strings include C-Currency, F-Fixed Point, G-General, N-Number, P-Percent)
3. Extended WPF Toolkit™ Community Edition MaskedTextBox (For fixed-length formatted strings such as phone number or social security number)
4. Extended WPF Toolkit™ Community Edition MultiLineTextEditor
5. System.Windows.Controls.TextBox
6. System.Windows.Controls.DatePicker
7. System.Windows.Forms.DataVisualization.Charting.Chart

Last edited Oct 8, 2014 at 3:23 AM by stagathome0069, version 570