2013-07-16 160 views
0

我正在使用DevExpress WPF MVVM框架。我想添加這個圖像所顯示的「Home」選項卡上方的按鈕。這怎麼可能? enter image description here如何將按鈕添加到DevExpress RibbonControl?

<dxb:BarManager> 
    <dxb:BarManager.Items> 
     <dxb:BarButtonItem x:Name="barButtonItem1" Content="About" Glyph="pack://application:,,,/DevExpress.Images.v13.1;component/Images/Support/Info_16x16.png" LargeGlyph="pack://application:,,,/DevExpress.Images.v13.1;component/Images/Support/Info_32x32.png" Command="{Binding ShowAboutCommand}"/> 
     <dxb:BarButtonItem x:Name="barButtonItem2" Content="New" /> 
     <dxb:BarButtonItem x:Name="SaveCommandBarButtonItem" Content="Save" /> 
    </dxb:BarManager.Items> 
...    

回答

0

你願意做的不是加按鈕什麼,但頁面

採取下面這個鏈接看看:

http://documentation.devexpress.com/#wpf/CustomDocument7954


編輯因發表評論

即 「區域」 要添加按鈕被稱爲頁眉在一個絲帶。

這下面的鏈接介紹如何,但它們有:

http://documentation.devexpress.com/#wpf/CustomDocument8186

我不知道什麼施膠/定位功能,你將有雖然(考慮到你在你的圖像意圖的準確佈局)。

+0

不,我不想添加頁面,我只是想在那裏添加按鈕 –

0

您不能在RibbonControl的任何位置添加按鈕,因爲RibbonControl不打算以這種方式使用。您應該使用合併到groupspages中的ribbon item links(按鈕,子菜單,就地編輯器,畫廊等)。請查閱RibbonControl Concepts文章以獲取更多信息。
相關例子:How to create a Ribbon Control

如果你想在RibbonControl(頁頭區域)的右邊緣添加項目,你可以使用How to add commands to the Page Header Region文章中介紹的方法。

如果要將項目添加到RibbonControl(Quick Access Toolbar)的頂部邊緣,可以使用How to add items to the Quick Access Toolbar文章中描述的方法。

P.S.我看到你正在使用MVVM框架。因此,您還應該查看以下文章:MVVM Framework Getting Started (Lesson 2) - Customize a Ribbon and Create an About Button