or
<Window x:Class="RadDockingTests.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <Style x:Key="CustomScrollViewerStyle" TargetType="ScrollViewer"> <Setter Property="VerticalScrollBarVisibility" Value="Disabled"/> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="HorizontalScrollBarVisibility" Value="Auto"/> </Trigger> <Trigger Property="IsMouseOver" Value="False"> <Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/> </Trigger> </Style.Triggers> </Style> </Window.Resources> <Grid> <telerik:RadDocking Name="radDocking"> <telerik:RadDocking.DocumentHost> <telerik:RadSplitContainer Orientation="Vertical"> <telerik:RadPaneGroup Name="radPaneGroup"> <telerik:RadPane Header="Pane One"> <telerik:RadPane.Content> <ScrollViewer Style="{StaticResource CustomScrollViewerStyle}"> <StackPanel Orientation="Horizontal"> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> </StackPanel> </ScrollViewer> </telerik:RadPane.Content> </telerik:RadPane> </telerik:RadPaneGroup> <telerik:RadPaneGroup> <telerik:RadPane Header="Pane Two"> <telerik:RadPane.Content> <ScrollViewer Style="{StaticResource CustomScrollViewerStyle}"> <StackPanel Orientation="Horizontal"> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> <Button Content="This is some filler content."/> </StackPanel> </ScrollViewer> </telerik:RadPane.Content> </telerik:RadPane> </telerik:RadPaneGroup> </telerik:RadSplitContainer> </telerik:RadDocking.DocumentHost> </telerik:RadDocking> </Grid></Window>private void ContextMenuSubscribe(){ this.radRichTextBox.ContextMenu = new Telerik.Windows.Controls.RichTextBoxUI.ContextMenu(); ContextMenu contextMenu = (ContextMenu)this.radRichTextBox.ContextMenu; contextMenu.Showing += this.ContextMenu_Showing;}private void ContextMenu_Showing(object sender, ContextMenuEventArgs e){ #region Discontinue Product Menu Item // First check the context - if last selected annotation is product and user permissions if (Properties.Settings.Default.SystemUserPermissions.ProductsCanDiscontinue == true && !(this.radRichTextBox.Document.Selection.IsEmpty) && RadDocumentExtensions.GetLastSelectedAnnotationMarker(this.radRichTextBox.Document) is SemanticRangeStart) { //Get the selected annotations List<SemanticRangeStart> products = RadDocumentExtensions.GetSelectedAnnotationsRangeStarts<SemanticRangeStart>(this.radRichTextBox.Document); //Check Product Count is greater than 0 if (products != null && products.Count > 0) { //Add menu item to data context RadMenuItem discontinueProductMenuItem = new RadMenuItem() { Header = "Discontinue Product", Icon = new System.Windows.Controls.Image() { Source = new BitmapImage(new Uri("Icons/Spec-Editor-Menu/block.png", UriKind.Relative)) }, Tag = products[products.Count - 1] //Get last product item in selection }; discontinueProductMenuItem.Click += this.DiscontinueProductMenuItem_Click; ContextMenuGroup customContextMenuGroup = new ContextMenuGroup(); customContextMenuGroup.Add(discontinueProductMenuItem); e.ContextMenuGroupCollection.Add(customContextMenuGroup); } } #endregion #region Product Pricing Menu Item // First check the context - if selected annotation is end product and user permissions if (Properties.Settings.Default.SystemUserPermissions.OrderCanEdit == true && !(this.radRichTextBox.Document.Selection.IsEmpty) && RadDocumentExtensions.GetLastSelectedAnnotationMarker(this.radRichTextBox.Document) is SemanticRangeStart) { //Get the selected annotations List<SemanticRangeStart> products = RadDocumentExtensions.GetSelectedAnnotationsRangeStarts<SemanticRangeStart>(this.radRichTextBox.Document); //Checked the last selected item is an end item //if (products.Count >= 0 && products[products.Count - 1].Product.HasChild == false) //{ //Add menu item to data context RadMenuItem addPriceMenuItem = new RadMenuItem() { Header = "Set Price", Icon = new System.Windows.Controls.Image() { Source = new BitmapImage(new Uri("Icons/Spec-Editor-Menu/sterling_pound_currency_50.png", UriKind.Relative)) }, Tag = products[products.Count - 1] }; addPriceMenuItem.Click += this.SetPriceMenuItem_Click; ContextMenuGroup customContextMenuGroup = new ContextMenuGroup(); customContextMenuGroup.Add(addPriceMenuItem); e.ContextMenuGroupCollection.Add(customContextMenuGroup); //} } #endregion #region Add New Item To Database Menu Item //Check Conditions if (Properties.Settings.Default.SystemUserPermissions.ProductsCanAdd == true && this.radRichTextBox.Document.Selection.IsEmpty && RadDocumentAutoComplete.IsPositionBetweenDefinedAnnotations(this.radRichTextBox.Document.CaretPosition) == false) { //Check if text exists at caret position string text = RadDocumentExtensions.GetSpanBoxText(this.radRichTextBox.Document.CaretPosition); if (!String.IsNullOrWhiteSpace(text)) { text.Trim(); //Create New Menu Item RadMenuItem addNewItemToDatabase = new RadMenuItem() { Header = "Add New Item", Icon = new System.Windows.Controls.Image() { Source = new BitmapImage(new Uri("Icons/Spec-Editor-Menu/Database-Add-48.png", UriKind.Relative)) } }; addNewItemToDatabase.Click += this.AddNewItemToDatabaseMenuItem_Click; ContextMenuGroup customContextMenuGroup = new ContextMenuGroup(); customContextMenuGroup.Add(addNewItemToDatabase); e.ContextMenuGroupCollection.Add(customContextMenuGroup); } } #endregion}