To get a vertical toolbar, you can edit the template:[INDENT]Open the project in Blend, rightclick the Toolbar and select to edit a copy of the template.Select the stackpanel called 'RootElement'.Change the orientation from Horizontal to Vertical. [/INDENT]But that doesn't allow to change the orientation at runtime. One option is to create your own ToolbarExt class derivating from the toolbar and to add an 'Orientation' property: Example C# code:
namespace ToolkitExt
{
public class ToolbarExt : Toolbar
{
public ToolbarExt()
{
this.DefaultStyleKey = typeof(ToolbarExt);
}
�??
public Orientation Orientation
{
get { return (Orientation)GetValue(OrientationProperty); }
set { SetValue(OrientationProperty, value); }
}
public static readonly DependencyProperty OrientationProperty =
DependencyProperty.Register("Orientation", typeof(Orientation), typeof(ToolbarExt), new PropertyMetadata(Orientation.Horizontal));
}
}
XAML code to put in generic.xaml file:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:toolkitext="clr-namespace:ToolkitExt">
<Style TargetType="toolkitext:ToolbarExt">
<Setter Property="ToolbarItemClickEffect" Value="Bounce" />
<Setter Property="MaxItemHeight" Value="110" />
<Setter Property="MaxItemWidth" Value="110" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="toolkitext:ToolbarExt">
<StackPanel x:Name="RootElement" Background="Transparent" HorizontalAlignment="Center" Orientation="{TemplateBinding Orientation}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
With this class you can initialize the orientation either in XAML or by code at run time.