There is actually a (subtle) difference between the two. Imagine you have the following code in File1.cs:
// File1.cs
using System;
namespace Outer.Inner
{
class Foo
{
static void Bar()
{
double d = Math.PI;
}
}
}
Now imagine that someone adds another file (File2.cs) to the project that looks like this:
// File2.cs
namespace Outer
{
class Math
{
}
}
The compiler searches Outer
before looking at those using
directives outside the namespace, so it finds Outer.Math
instead of System.Math
. Unfortunately (or perhaps fortunately?), Outer.Math
has no PI
member, so File1 is now broken.
This changes if you put the using
inside your namespace declaration, as follows:
// File1b.cs
namespace Outer.Inner
{
using System;
class Foo
{
static void Bar()
{
double d = Math.PI;
}
}
}
Now the compiler searches System
before searching Outer
, finds System.Math
, and all is well.
Some would argue that Math
might be a bad name for a user-defined class, since there's already one in System
; the point here is just that there is a difference, and it affects the maintainability of your code.
It's also interesting to note what happens if Foo
is in namespace Outer
, rather than Outer.Inner
. In that case, adding Outer.Math
in File2 breaks File1 regardless of where the using
goes. This implies that the compiler searches the innermost enclosing namespace before it looks at any using
directive.
Ill preface by saying I doubt this is the best way to do this.
This is my style for RibbonTab notice IsSelected is bound to IsSelected in The view model
<!-- RibbonTab -->
<Style TargetType="{x:Type ribbon:RibbonTab}">
<Setter Property="ContextualTabGroupHeader" Value="{Binding ContextualTabGroupHeader}" />
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="ItemsSource" Value="{Binding GroupDataCollection}" />
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
</Style>
This is view model code
public bool IsSelected
{
get
{
return _isSelected;
}
set
{
if (_isSelected != value)
{
_isSelected = value;
OnPropertyChanged(new PropertyChangedEventArgs("IsSelected"));
}
}
}
private bool _isSelected;
In the constructor for the TabViewModel I take a parameter for the ViewModel of the content
public TabData(ISelectedContentTab content)
: this(content.DisplayName)
{
_selectedContent = content;
}
private ISelectedContentTab _selectedContent;
Then I used an ItemsControl to display the selected content in my xaml
<ItemsControl Grid.Row="1" VerticalContentAlignment="Stretch" VerticalAlignment="Stretch"
ItemsSource="{Binding ElementName=ribbon,Path=SelectedItems}"
ItemTemplate="{StaticResource ContentControlTemplate}" />
And the ContentControlTemplate I have is
<DataTemplate x:Key="ContentControlTemplate">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ContentControl Grid.Row="0" VerticalAlignment="Stretch" Height="Auto" VerticalContentAlignment="Stretch" Content="{Binding SelectedContent}" />
</Grid>
</DataTemplate>
Also make sure you have a datatemplate pointing your content to a view
Hope this helps.
Best Answer
TLDR: I think it fits to your application concept, but there has to be a clear distinction between the people and tasks functions to make it work!
Though Scott has a point that it might be somewhat in contrast to what Microsoft intended to use the Ribbon for, it think the Ribbon also fits to this kind of use. Since if you wanted to have a conventional tab like Michael suggests you would need buttons to switch between the windows or tasks. By using the Ribbon you directly link the controlling functions/buttons with the task' tab, making it easier to learn what buttons are linked to what task. Buttons that are used for the whole app can be integrated into the Office button (the large Office logo in the top left corner), which is actually exactly what Microsoft does.
We are currently implementing a Ribbon-like toolbar as well, so probably I'm not entirely objective. However I tend to think the Ribbon works quite simple and enables users to easily discover buttons. One side-note: this could also be achieved by using large logo's and dropdown gallery's, it's just easy that most Ribbon packages available have these things implemented, so no need to code it yourself (unless you can very easily)!