First of all, is it possible? Then, is it viable?
If at least one of above is yes, how?
How do we treat commands in code behind?
And if we use MVVM?
4 Answers, 1 is accepted
You can place any UI element inside RadDataForm. Customizing what gets displayed in RadDataForm is demonstrated here. We have a RadRichTextBox control which provides many of the features of the MsWord editor and you can place RadRichTextBox inside RadDataForm.
All of our controls are MVVM compatible so you should not have any problems if you follow the MVVM approach.
All the best,
Milan
the Telerik team
I have the same problem. After put the RitchTextBox inside of DataForm, I want have some events, so I need using commands.
It´s possible using commands inside of DataFormDataField?
Like this:
<
telerik:DataFormDataField
Grid.Row
=
"1"
>
<
telerik:RadRichTextBoxRibbonUI
telerik:StyleManager.Theme
=
"Transparent"
Grid.Row
=
"1"
Margin
=
"0,100,0,0"
ApplicationButtonImageSource
=
"/RichTextBox;component/Images/RichTextBox/MSOffice/AppIcon-telerik.png"
Height
=
"207"
Grid.RowSpan
=
"2"
>
<
telerik:RadRichTextBoxRibbonUI.Resources
>
<
telerik:FontFamiliesProvider
x:Key
=
"FontFamiliesProvider"
/>
</
telerik:RadRichTextBoxRibbonUI.Resources
>
<
telerik:RadRichTextBoxRibbonUI.ApplicationMenu
>
<
telerik:ApplicationMenu
Height
=
"267"
>
<
telerik:ApplicationMenu.Content
>
<
StackPanel
Width
=
"230"
/>
</
telerik:ApplicationMenu.Content
>
<
telerik:RadRibbonButton
LargeImage
=
"/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/open.png"
Text
=
"Abrir"
Command
=
"{Binding Comando}"
/>
</
telerik:ApplicationMenu
>
</
telerik:RadRichTextBoxRibbonUI.ApplicationMenu
>
</
telerik:RadRichTextBoxRibbonUI
>
<!--<telerik:RadRichTextBox Margin="0"/>-->
</
telerik:DataFormDataField
>
private ICommand _comando;
public ICommand Comando
{
get { return _comando; }
set { _comando = value; }
}
//Contrutor I have this:
_comando = new RelayCommand(Altera) { IsEnabled = true };
//Where "Altera" is my method for this command
Thanks in advance.
I solve the problem with this: Command="{Binding Comando, Source={StaticResource cmd}}", where the cmd is a key of my ViewModel and Comando is my command.
<telerik:RadRichTextBox IsReadOnly="True" Grid.Row="3" Grid.Column="2" FontSize="12" DocumentInheritsDefaultStyleSettings="True" Height="Auto" HorizontalAlignment="Left"
HorizontalScrollBarVisibility="Hidden" IsContextMenuEnabled="False" IsSelectionMiniToolBarEnabled="False"
IsSpellCheckingEnabled="True" Name="rtbNoticed"
VerticalScrollBarVisibility="Auto" Width="200" IsEnabled="False">
<telerik:RadRichTextBox.Resources>
<my1:HtmlDataProvider x:Key="provider" DataContext="{Binding ElementName=radDataForm1,Path=SelectedItem}" RichTextBox="{Binding ElementName=rtbNoticed}" Html="{Binding Noticed, Mode=TwoWay}" />
</telerik:RadRichTextBox.Resources>