This question is locked. New answers and comments are not allowed.
Hi,
I try to create a RadRichTextBoxRibbonUI and a RadRichTextBox. The xaml code is,
The C# code to dynamically create them is,
However the code to
Thanks,
York
I try to create a RadRichTextBoxRibbonUI and a RadRichTextBox. The xaml code is,
<
telerik:RadRichTextBox
Grid.Row
=
"1"
HorizontalAlignment
=
"Stretch"
IsContextMenuEnabled
=
"True"
IsSelectionMiniToolBarEnabled
=
"True"
IsSpellCheckingEnabled
=
"True"
LayoutMode
=
"Paged"
Name
=
"radRichTextBox1"
/>
<
telerik:RadRichTextBoxRibbonUI
BackstageClippingElement
=
"{Binding ElementName=gridRadRtbParent}"
CollapseThresholdSize
=
"50,50"
DataContext
=
"{Binding Path=Commands, ElementName=radRichTextBox1}"
ApplicationName
=
"Edit Letters"
>
The C# code to dynamically create them is,
RadRichTextBoxRibbonUI ribbonUI = CreateRibbonUI();
ribbonUI.CollapseThresholdSize = new Size(50, 50);
// Create a new RadRichTextBox
RadRichTextBox richTextBox = new RadRichTextBox();
richTextBox.Name = "radRichTextBox1";
richTextBox.IsSpellCheckingEnabled = true;
richTextBox.IsSelectionMiniToolBarEnabled = true;
richTextBox.IsContextMenuEnabled = true;
richTextBox.LayoutMode = DocumentLayoutMode.Paged;
// Bind RadRichTextBox to RadRichTextBoxRibbonUI's datacontext
binding = new Binding(richTextBox.Name);
binding.Path = new PropertyPath("Commands");
binding.Source = ribbonUI;
ribbonUI.SetBinding(RadRichTextBoxRibbonUI.DataContextProperty, binding);
However the code to
bind RadRichTextBox to RadRichTextBoxRibbonUI's datacontext
does not work because they are not binded. How to bind RadRichTextBoxRibbonUI and RadRichTextBox in C# that achieve the xaml code above?Thanks,
York