Friday, September 14, 2012

Ribbon is now available in WPF!

With .NET Framework 4.5 and Visual Studio 2012 standard Ribbon control is finally available for WPF applications. We don't need to search for 3d controls any more!

To use ribbon you need to add reference to System.Windows.Controls.Ribbon in your WPF application.

After that you should be able to write XAML code like that:
<Window x:Class="TestRibbon.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
  <Grid>
    <Ribbon>
      <RibbonTab x:Name="Home" Header="Home">
        <RibbonButton x:Name="HomeButton" Label="Home"/>
      </RibbonTab>
      <RibbonTab x:Name="FTP" Header="FTP">
        <RibbonButton x:Name="UploadButton" Label="Upload"/>
        <RibbonButton x:Name="DownloadButton" Label="Download"/>
      </RibbonTab>
    </Ribbon>
  </Grid>
</Window>
This will allow you to see the simple ribbon. Set SmallImageSource and LargeImageSource properties to make your ribbon buttons look nice.




No comments:

Post a Comment