Подключение Ribbon панели в C# на WPF

Установка

  • Перейти на сайт Microsoft и скачать "Microsoft Ribbon for WPF.msi" и установить его.
  • Запустить среду разработки, создать проект, и выбрать шаблон "WPF Ribbon Application".
  • Создастся автоматически сгенерированное окно с примером Ribbon панели.
<ribbon:RibbonWindow x:Class="WpfRibbonApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
        Title="MainWindow"
		x:Name="RibbonWindow"
		Width="640" Height="480">

	<Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <ribbon:Ribbon x:Name="Ribbon">
            <ribbon:Ribbon.ApplicationMenu>
                <ribbon:RibbonApplicationMenu SmallImageSource="Images\SmallIcon.png">
                    <ribbon:RibbonApplicationMenuItem Header="Hello _Ribbon"
                                                      x:Name="MenuItem1"
                                                      ImageSource="Images\LargeIcon.png"/>
                </ribbon:RibbonApplicationMenu>
            </ribbon:Ribbon.ApplicationMenu>
            <ribbon:RibbonTab x:Name="HomeTab" 
                              Header="Home">
                <ribbon:RibbonGroup x:Name="Group1" 
                                    Header="Group1">
                    <ribbon:RibbonButton x:Name="Button1"
                                         LargeImageSource="Images\LargeIcon.png"
                                         Label="Button1" />

                    <ribbon:RibbonButton x:Name="Button2"
                                         SmallImageSource="Images\SmallIcon.png"
                                         Label="Button2" />
                    <ribbon:RibbonButton x:Name="Button3"
                                         SmallImageSource="Images\SmallIcon.png"
                                         Label="Button3" />
                    <ribbon:RibbonButton x:Name="Button4"
                                         SmallImageSource="Images\SmallIcon.png"
                                         Label="Button4" />
                    
                </ribbon:RibbonGroup>
                
            </ribbon:RibbonTab>
        </ribbon:Ribbon> 
        
    </Grid>
</ribbon:RibbonWindow>



Ribbon.jpg

Last edited Feb 25, 2012 at 7:16 AM by Gibrid, version 3

Comments

No comments yet.