Set the SchedulerControl.CommandBarStyle property to CommandBarStyle.Ribbon to display the integrated ribbon with all the available scheduler commands.
Xaml |
<dxsch:SchedulerControl x:Name="scheduler" CommandBarStyle="Ribbon"/>
|
The following image shows the resulting application:
Add the following namespace declarations to the MainWindow.xaml file:
Xaml |
xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
|
To modify the Scheduler's ribbon UI, add the necessary customization actions to the SchedulerControl.RibbonActions collection. The action's ElementName property specifies the name of the existing ribbon element you wish to change or remove. Element names are the DevExpress.Xpf.Scheduling.DefaultBarItemNames class fields. You can deduce the required element's name by following the naming rules listed in the table below:
Ribbon Element
|
Element Type
|
Page Name
|
Group Name
|
Item Name
|
DefaultBarItemNames Field
|
Page/Tab
 |
Pages |
Home |
|
|
Pages_Home |
Group
 |
Groups |
Home |
Appointment |
|
Groups_Home_Appointment |
Item
 |
Items |
Home |
Appointment |
NewAppointment |
Items_Home_Appointment_NewAppointment |
Select the action you wish to perform:
-
Remove a Ribbon Element
-
Modify a Ribbon Element
-
Add a New Ribbon Element
-
Remove a Ribbon Element
To remove an element from the ribbon, add a RemoveAction with the required element's name to the SchedulerControl.RibbonActions collection.
The following code demonstrates how to remove a specific ribbon group and item:
Xaml |
<dxsch:SchedulerControl.RibbonActions>
<dxb:RemoveAction ElementName="{x:Static Member=dxsch:DefaultBarItemNames.Groups_Home_Window }"/>
<dxb:RemoveAction ElementName="{x:Static Member=dxsch:DefaultBarItemNames.Items_Home_Navigate_GotoToday }"/>
</dxsch:SchedulerControl.RibbonActions>
|
-
Modify a Ribbon Element
Use an UpdateAction to change an existing ribbon element. Specify the element's name, the property you wish to modify and the new value that should be assigned to this property.
The example below demonstrates how to disable the Appointment group on the ribbon and hide the Group by Date button.
Xaml |
<dxb:UpdateAction ElementName="{x:Static dxsch:DefaultBarItemNames.Groups_Home_Appointment }"
PropertyName="IsEnabled"
Value="False"/>
<dxb:UpdateAction ElementName="{x:Static dxsch:DefaultBarItemNames.Items_Home_GroupBy_GroupByDate }"
PropertyName="IsVisible"
Value="False"/>
|
-
Add a New Ribbon Element
To add a new element to the ribbon, add an InsertAction to the SchedulerControl.RibbonActions collection.
The code below demonstrates how to create a new ribbon button. The About button is located in a separate Example group and uses the BarItem.ItemClick event to display a custom message containing information about the current example.
Xaml |
<dxb:InsertAction ContainerName="{x:Static dxsch:DefaultBarItemNames.Pages_Home}" Index="6">
<dxr:RibbonPageGroup Caption="Example">
<dxb:BarButtonItem Content="About"
ItemClick="About_ItemClick"
LargeGlyph="{dx:DXImageOffice2013 Image=Info_32x32.png}"/>
</dxr:RibbonPageGroup>
</dxb:InsertAction>
|
Handle the About button's BarItem.ItemClick event as shown below.
C#:MainWindow.xaml.cs |
void About_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) {
DXMessageBox.Show(@"This example demonstrates how to customize the WPF Scheduler's integrated ribbon UI. Use the Scheduler's RibbonActions collection to create, remove or modify ribbon elements.",
"Scheduler Ribbon Example", MessageBoxButton.OK, MessageBoxImage.Information);
}
|
VB:MainWindow.xaml.vb |
Private Sub About_ItemClick(ByVal sender As Object, ByVal e As DevExpress.Xpf.Bars.ItemClickEventArgs)
DXMessageBox.Show("This example demonstrates how to customize the WPF Scheduler's integrated ribbon UI. Use the Scheduler's RibbonActions collection to create, remove or modify ribbon elements.", "Scheduler Ribbon Example", MessageBoxButton.OK, MessageBoxImage.Information)
End Sub
|
The complete XAML code for the Scheduler with a custom ribbon is shown below:
Run the application. The following image illustrates the result: