Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. Link a RibbonTab to its own Workspace

Link a RibbonTab to its own Workspace

Scheduled Pinned Locked Moved WCF and WF
workspacewpfwcfquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sevententh
    wrote on last edited by
    #1

    I'm trying to create a workspace for each RibbonTab of my app. But I'm struggling to workout the best method to do this. RibbonTabs are setup as:

    <r:RibbonTab Label="Home" Behaviors:SingleEventCommand.RoutedEventName="Selected" Behaviors:SingleEventCommand.TheCommandToRun="{Binding Tab_HomeSelected}" >
    <r:RibbonGroup Name="Documentation" Command="{StaticResource DocumentationGroupCommand}">
    <r:RibbonButton Command="{StaticResource GeneralDocCommand}" />
    <r:RibbonButton Command="{StaticResource FactsDocCommand}" />
    </r:RibbonGroup>
    </r:RibbonTab>
    <r:RibbonTab Label="Config" Behaviors:SingleEventCommand.RoutedEventName="Selected" Behaviors:SingleEventCommand.TheCommandToRun="{Binding Tab_ConfigSelected}" >
    <r:RibbonGroup Name="Documents" Command="{StaticResource DocumentGroupCommand}">
    <r:RibbonButton Command="{StaticResource DocsCommand}" />
    </r:RibbonGroup>
    </r:RibbonTab>

    The workspaces/viewmodels are currently inside a Tabcontrol

    <local:TabControlEx x:Name="tabControl"
    IsSynchronizedWithCurrentItem="True"
    ItemsSource="{Binding Path=Workspaces}"
    Template="{StaticResource MainTabControlTemplateEx}">
    </local:TabControlEx>

    public MainViewModel()
    {
    #region Workspaces
    ///Build workspace areas for each ribbon tab
    Workspaces = new ObservableCollection<ViewModelBase>();
    Workspaces.CollectionChanged += this.OnWorkspacesChanged;

    HomeViewModel vmH = new HomeViewModel();
    vmH.IsCloseable = false;
    Workspaces.Add(vmH);
    
    ConfigViewModel vmCf = new ConfigViewModel();
    vmCf.IsCloseable = false;
    Workspaces.Add(vmCf);
    
    tabH = new SimpleCommand
    {
    CanExecuteDelegate = x => true,
    ExecuteDelegate = x => ExecuteCommandHome()
    };
    tabC = new SimpleCommand
    {
    CanExecuteDelegate = x =&gt; true,
    ExecuteDelegate = x =&gt; ExecuteCommandConfig()
    };
    

    }
    public ICommand Tab_HomeSelected { get {return tabH; } }
    public ICommand Tab_ConfigSelected { get {return tabC; } }

    This method works currently when switching from one RibbonTab to another but the tabcontrol also shows the tab headings for each Ribbontab... not very nice. Does anybody have a better solution or suggestion as to how this could work? Many Thanks

    C 1 Reply Last reply
    0
    • S Sevententh

      I'm trying to create a workspace for each RibbonTab of my app. But I'm struggling to workout the best method to do this. RibbonTabs are setup as:

      <r:RibbonTab Label="Home" Behaviors:SingleEventCommand.RoutedEventName="Selected" Behaviors:SingleEventCommand.TheCommandToRun="{Binding Tab_HomeSelected}" >
      <r:RibbonGroup Name="Documentation" Command="{StaticResource DocumentationGroupCommand}">
      <r:RibbonButton Command="{StaticResource GeneralDocCommand}" />
      <r:RibbonButton Command="{StaticResource FactsDocCommand}" />
      </r:RibbonGroup>
      </r:RibbonTab>
      <r:RibbonTab Label="Config" Behaviors:SingleEventCommand.RoutedEventName="Selected" Behaviors:SingleEventCommand.TheCommandToRun="{Binding Tab_ConfigSelected}" >
      <r:RibbonGroup Name="Documents" Command="{StaticResource DocumentGroupCommand}">
      <r:RibbonButton Command="{StaticResource DocsCommand}" />
      </r:RibbonGroup>
      </r:RibbonTab>

      The workspaces/viewmodels are currently inside a Tabcontrol

      <local:TabControlEx x:Name="tabControl"
      IsSynchronizedWithCurrentItem="True"
      ItemsSource="{Binding Path=Workspaces}"
      Template="{StaticResource MainTabControlTemplateEx}">
      </local:TabControlEx>

      public MainViewModel()
      {
      #region Workspaces
      ///Build workspace areas for each ribbon tab
      Workspaces = new ObservableCollection<ViewModelBase>();
      Workspaces.CollectionChanged += this.OnWorkspacesChanged;

      HomeViewModel vmH = new HomeViewModel();
      vmH.IsCloseable = false;
      Workspaces.Add(vmH);
      
      ConfigViewModel vmCf = new ConfigViewModel();
      vmCf.IsCloseable = false;
      Workspaces.Add(vmCf);
      
      tabH = new SimpleCommand
      {
      CanExecuteDelegate = x => true,
      ExecuteDelegate = x => ExecuteCommandHome()
      };
      tabC = new SimpleCommand
      {
      CanExecuteDelegate = x =&gt; true,
      ExecuteDelegate = x =&gt; ExecuteCommandConfig()
      };
      

      }
      public ICommand Tab_HomeSelected { get {return tabH; } }
      public ICommand Tab_ConfigSelected { get {return tabC; } }

      This method works currently when switching from one RibbonTab to another but the tabcontrol also shows the tab headings for each Ribbontab... not very nice. Does anybody have a better solution or suggestion as to how this could work? Many Thanks

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      What is a RibbonTab ?

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups