If, like me, you are interested in using all the new fangled controls produced by every man and his dog, you will probably have come across the Infragistics WPF control. My mission, that I stupidly accepted, was to update the TFS Sticky Buddy application with their XamRibbon and XamDockManager controls, and anything else I can stuff in there.

The “anything else” I decided to use was the Composite WPF guidance. This is a newer WPF version of the Client Application Block (CAB) packages provided by the Patterns and Practices teams at Microsoft.
Anyhoo, I though I should give some advice for those of you mixing these technologies. I seam to have licked the XamRibbon implementation, but I am still working on the XamDockManager bits.
Note: You will need to be familiar with the Composite WPF bits for this all to make sense.
1: <igRibbon:XamRibbon x:Name="uxXamRibbon" cal:RegionManager.RegionName="{x:Static inf:RegionNames.Shell_Ribbon}"
AllowMinimize="True" AutoHideEnabled="False" IsMinimized="False">
2: <igRibbon:XamRibbon.ApplicationMenu>
3: <igRibbon:ApplicationMenu cal:RegionManager.RegionName="{x:Static inf:RegionNames.Shell_RibbonApplicationMenu}"
Image="/Hinshelwood.TFSStickyBuddy;component/RDIcon.ico">
4: <igRibbon:ApplicationMenu.FooterToolbar>
5: <igRibbon:ApplicationMenuFooterToolbar cal:RegionManager.RegionName="{x:Static inf:RegionNames.Shell_RibbonApplicationMenuFooterToolbar}">
6: </igRibbon:ApplicationMenuFooterToolbar>
7: </igRibbon:ApplicationMenu.FooterToolbar>
8: </igRibbon:ApplicationMenu>
9: </igRibbon:XamRibbon.ApplicationMenu>
10: </igRibbon:XamRibbon>
As you can see there are a number of regions here, for the Tabs, the Application Menu and the FooterToolbar. You will need both a XamRibbon and a RibbonTabItem adapter.
1: Public Class RibbonRegionAdapter
2: Inherits RegionAdapterBase(Of XamRibbon)
3:
4: Private m_regionTarget As XamRibbon
5:
6: Protected Overrides Sub Adapt(ByVal region As Microsoft.Practices.Composite.Regions.IRegion, ByVal regionTarget As XamRibbon)
7: m_regionTarget = regionTarget
8: regionTarget.Tabs.Clear()
9: AddHandler region.ActiveViews.CollectionChanged, AddressOf OnActiveViewsChanged
10: For Each v As RibbonTabItem In region.ActiveViews
11: regionTarget.Tabs.Add(v)
12: Next
13:
14: End Sub
15:
16: Private Sub OnActiveViewsChanged(ByVal sender As Object, ByVal e As NotifyCollectionChangedEventArgs)
17: Select Case e.Action
18: Case NotifyCollectionChangedAction.Add
19: For Each v In e.NewItems
20: m_regionTarget.Tabs.Add(v)
21: Next
22: Case NotifyCollectionChangedAction.Remove
23: For Each v In e.OldItems
24: m_regionTarget.Tabs.Remove(v)
25: Next
26: End Select
27: End Sub
28:
29: Protected Overrides Function CreateRegion() As Microsoft.Practices.Composite.Regions.IRegion
30: Return New AllActiveRegion
31: End Function
32:
33: End Class
1: Public Class RibbonTabItemRegionAdapter
2: Inherits RegionAdapterBase(Of RibbonTabItem)
3:
4: Private m_regionTarget As RibbonTabItem
5:
6: Protected Overrides Sub Adapt(ByVal region As Microsoft.Practices.Composite.Regions.IRegion, ByVal regionTarget As RibbonTabItem)
7: m_regionTarget = regionTarget
8: regionTarget.Content.Clear()
9: AddHandler region.ActiveViews.CollectionChanged, AddressOf OnActiveViewsChanged
10: For Each v As Object In region.ActiveViews
11: regionTarget.Content.Add(v)
12: Next
13:
14: End Sub
15:
16: Private Sub OnActiveViewsChanged(ByVal sender As Object, ByVal e As NotifyCollectionChangedEventArgs)
17: Select Case e.Action
18: Case NotifyCollectionChangedAction.Add
19: For Each v In e.NewItems
20: m_regionTarget.Content.Add(v)
21: Next
22: Case NotifyCollectionChangedAction.Remove
23: For Each v In e.OldItems
24: m_regionTarget.Content.Remove(v)
25: Next
26: End Select
27: End Sub
28:
29: Protected Overrides Function CreateRegion() As Microsoft.Practices.Composite.Regions.IRegion
30: Return New AllActiveRegion
31: End Function
32:
33: End Class
I am pretty sure that these can be augmented, and I can think of a few Ideas already, including adding a re-parenting ability to allow menu items to be added to the XAML as well as programmatically added.
I think I might have to go away and try this…
Technorati Tags: WPF CodeProject
Smart Classifications
Each classification [Concepts, Categories, & Tags] was assigned using AI-powered semantic analysis and scored across relevance, depth, and alignment. Final decisions? Still human. Always traceable. Hover to see how it applies.
What to read next
Creating a WPF Work Item Control
Learn how to build a custom WPF work item control for Visual Studio Team System, enabling WPF UI integration in work item forms using a …
Wpf Drag & Drop behaviour
Explains how to implement flexible drag and drop in WPF using MVVM, with customisable drop behaviour and bindable options for ItemsControls, …
TFS Sticky Buddy layout fun
A developer shares challenges and insights from building a TFS Sticky Buddy UI in WinForms and WPF, comparing layout issues and ease of use …
The Evolution of My Journey with Azure DevOps: Lessons and Insights
Personal experiences and lessons on using Azure DevOps, covering its evolution, migration strategies, custom tools, and practical advice for …
Detecting agile theatre with real delivery signals
Why Most Companies Operating Models Fail in Dynamic Markets
A concise comparison of Predictive and Adaptive Operating Models, explaining why traditional structures fail in dynamic markets and how …
Don’t Manage Dependencies, Remove Them
Explains why dependencies are a sign of poor system design and outlines steps to eliminate them by aligning teams, clarifying ownership, and …
The Estimation Trap: How Tracking Accuracy Undermines Trust, Flow, and Value in Software Delivery
Tracking estimation accuracy in software delivery leads to mistrust, fear, and distorted behaviours. Focus on customer value, flow, and …
Flow of Value vs Flow of Work – Misnomer or Useful Shorthand?
Compares “flow of value” and “flow of work” in Kanban, explaining why only validated outcomes count as value and stressing the need for …
Why Outsourcing DevOps Fails, and How Real Engineering Excellence Starts With Your Team
Avoid DevOps vendor lock-in, discover how true engineering excellence starts with partnership, not outsourcing. Ready to transform your …