Hi,
I am considering using the Ribbon, Outlookbar and and Status bar for a new Prism Project.
Do you have any sample prism projects showing how to use these tools with prism?
Regards.
Using any Infragistics control with Prism is extremely simple, especially with the XamRibbon and XamOutlookBar. You can follow my blog as I am recording a series of vidoes on how to use Prism with our controls.
http://community.infragistics.com/blogs/blagunas/default.aspx
So far I have only recorded 4 episodes, but more will follow.
For the ribbon
We are using Infragistics together with Prism 4.1 and it works, just use attached properties to bind a contenthost to a regionmanager.
And ofcourse write a RegionAdapter for the Ribbon.
Our shell window:
<igRibbon:XamRibbonWindow x:Class="Shell" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cal="http://www.codeplex.com/CompositeWPF" xmlns:igDock="http://infragistics.com/DockManager" xmlns:igRibbon="http://infragistics.com/Ribbon" Title="Title" WindowState="Maximized" Closing="XamRibbonWindow_Closing"> <igRibbon:RibbonWindowContentHost cal:RegionManager.RegionName="MenuRegion"> <igRibbon:RibbonWindowContentHost.StatusBar> <StatusBar Name="StatusBar1"> <StatusBar.ItemsPanel> <ItemsPanelTemplate> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*"></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition> </Grid.ColumnDefinitions> </Grid> </ItemsPanelTemplate> </StatusBar.ItemsPanel> <StatusBarItem Grid.Column="0"> <TextBlock x:Name="txtVersion" Margin="5" HorizontalAlignment="Right"></TextBlock> </StatusBarItem> <StatusBarItem Grid.Column="1"> <TextBlock x:Name="txtIngelogdeGebruiker" Margin="5" HorizontalAlignment="Right"></TextBlock> </StatusBarItem> </StatusBar> </igRibbon:RibbonWindowContentHost.StatusBar> <Grid Background="{DynamicResource BackgroundBrush}"> <Grid.RowDefinitions> <RowDefinition Height="*"></RowDefinition> </Grid.RowDefinitions> <igDock:XamDockManager Grid.Row="0" x:Name="dockingManager" Margin="0,0,0,0" VerticalAlignment="Stretch" NavigationOrder="VisibleOrder" > <!-- The Panes collection is collection used to create the root split pane that contain the floating, docked and unpinned content panes --> <igDock:XamDockManager.Panes> <igDock:SplitPane igDock:XamDockManager.InitialLocation="DockedLeft" SplitterOrientation="Horizontal" Height="{Binding Path=ActualHeight, ElementName=dockingManager, Mode=OneWay}" Width="{Binding Path=ActualWidth, ElementName=dockingManager, Mode=OneWay}" > <igDock:TabGroupPane cal:RegionManager.RegionName="LeftRegion" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"> </igDock:TabGroupPane> </igDock:SplitPane> <igDock:SplitPane igDock:XamDockManager.InitialLocation="DockedBottom" SplitterOrientation="Vertical"> <igDock:TabGroupPane cal:RegionManager.RegionName="BottomRegion" Height="200" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"> </igDock:TabGroupPane> </igDock:SplitPane> </igDock:XamDockManager.Panes> <igDock:DocumentContentHost> <!-- a document content host contains 1 or more split panes --> <igDock:SplitPane> <!-- those split panes can only contain a tabgrouppane --> <igDock:TabGroupPane Name="WorkRegion" cal:RegionManager.RegionName="WorkRegion" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"> </igDock:TabGroupPane> </igDock:SplitPane> </igDock:DocumentContentHost> </igDock:XamDockManager> </Grid> </igRibbon:RibbonWindowContentHost> </igRibbon:XamRibbonWindow>
and our adapter
public class RibbonWindowContentHostRegionAdapter : RegionAdapterBase<RibbonWindowContentHost>, IRibbonWindowContentHostRegionAdapter { private XamRibbon FindRibbonOnView(object view) { DependencyObject viewAsDependency = view as DependencyObject; if (viewAsDependency == null) { return null; } IEnumerable children = LogicalTreeHelper.GetChildren(viewAsDependency); foreach (object child in children) { if (typeof(XamRibbon).IsAssignableFrom(child.GetType())) { return child as XamRibbon; } XamRibbon result = FindRibbonOnView(child); if (result != null) { return result; } } return null; } public RibbonWindowContentHostRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory) : base(regionBehaviorFactory) { } protected override void Adapt(IRegion region, RibbonWindowContentHost regionTarget) { bool contentIsSet = regionTarget.Ribbon != null; if (contentIsSet) { throw new InvalidOperationException("Only a single instance of the Ribbon is allowed on the host."); } region.Views.CollectionChanged += (sender, e) => { if (e.Action == NotifyCollectionChangedAction.Add && region.ActiveViews.Count() == 0) { XamRibbon menu = FindRibbonOnView(region.Views.FirstOrDefault()); if (menu == null) { throw new InvalidOperationException("No XamRibbon found in view."); } else if (typeof(Panel).IsAssignableFrom(menu.Parent.GetType())) { (menu.Parent as Panel).Children.Remove(menu); regionTarget.Ribbon = menu; region.Activate(e.NewItems[0]); } else { throw new InvalidOperationException("Parent of the XamRibbon must be a Panel."); } } }; } protected override IRegion CreateRegion() { return new SingleActiveRegion(); } } }
In the bootstrapper register the adapter for the RibbonWindowContentHost regionAdapterMappings.RegisterMapping(typeof(RibbonWindowContentHost), Container.Resolve<RibbonWindowContentHostRegionAdapter>());
Hello,
Thank you for your post. I have been looking into it and I can say that currently we do not provide samples that shows how to use the controls you mention with Prism, but if you want we can make an extra effort and create such samples for you.
Looking forward for your reply.