Silverlight RichTextBox and UIElementCollection
I am currently trying to implement the Silverlight RadRichText in a user control with the example shown on this RichTextBox example. Using the DataProvider, the code that they are showing is this (sorry for the formatting):
<UserControl x:Class="DataProvidersDemo.MainPage"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:telerikDocumentsXAML="clr-namespace:Telerik.Windows.Documents.FormatProviders.Xaml;assembly=Telerik.Windows.Documents.FormatProviders.Xaml">
<Grid x:Name="LayoutRoot"
Background="White">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<telerikDocumentsXAML:XamlDataProvider x:Key="xamlDataProvider"
Xaml="{Binding ElementName=radTextBox, Path=Text, Mode=TwoWay}"
RichTextBox="{Binding ElementName=radRichTextBo开发者_运维知识库x}" />
<telerik:RadRichTextBox Margin="2" Name="radRichTextBox" />
<TextBox Margin="2" Grid.Row="1" Name="radTextBox" />
</Grid>
</UserControl>
and I get that error : A value of type 'XamlDataProvider' cannot be added to a collection or dictionary of type 'UIElementCollection'.
And I don't have a clue where to look anymore
<telerikDocumentsXAML:XamlDataProvider x:Key="xamlDataProvider" Xaml="{Binding ElementName=radTextBox, Path=Text, Mode=TwoWay}" RichTextBox="{Binding ElementName=radRichTextBox}" />
needs to be put into your UserControl Resource section.
<UserControl.Resources>
<telerikDocumentsXAML:XamlDataProvider x:Key="xamlDataProvider" Xaml="{Binding ElementName=radTextBox, Path=Text, Mode=TwoWay}" RichTextBox="{Binding ElementName=radRichTextBox}" />
</UserControl.Resources>
精彩评论