XamRibbon Region Adapter???

May 25, 2010 at 12:55 AM

Hello,

    Can somebody show me the XamRibbon Region Adapter?

    Thank you very much.

 

yours,

May 25, 2010 at 11:37 AM

To use it effectively you need to create your region and your region adapter. Here's the code.

// create your region adapter

public class XamRibbonRegionAdapter : RegionAdapterBase<XamRibbon>

   {

 

 

       public XamRibbonRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)  : base(regionBehaviorFactory)

       {  }

       protected override void Adapt(IRegion region, XamRibbon regionTarget)

       {

           XamRibbonRegion reg = (XamRibbonRegion)region; 

           reg.MyRibbon = regionTarget;

       }

       protected override IRegion CreateRegion()

       {           return new XamRibbonRegion();       }

   }

   // create your region

   public class XamRibbonRegion : SingleActiveRegion

   {

       public XamRibbon MyRibbon { get; set; }

       public RibbonTabItem MyRibbonTab { get; set; }

        public override IRegionManager Add(object view, string viewName, bool createRegionManagerScope)

       {

           MyRibbonTab = view as RibbonTabItem;

           MyRibbon.Tabs.Add(MyRibbonTab);

           return base.Add(view, viewName, createRegionManagerScope);

       }

       public override void Remove(object view)

       {

           MyRibbon.Tabs.Remove((RibbonTabItem)view);

           base.Remove(view);

       }

   }

 

May 25, 2010 at 11:21 PM

Thank you very much , I will try it.

Sep 29, 2010 at 1:25 PM

Will this also work with Silverlight ?