I followed the example described in Help and use XamlDataProvider to bind to my view model. However, the performance is very slow, border line unusable. With the provider sometime I can type a whole word before it appears in rich text box. Is there a solution short of not using provider? I want to mention that performance degrades very rapidly after I have a couple of custom controls inside InlineUIcontainer, so I think this is primary bottleneck in data binding.
Thanks.
3 Answers, 1 is accepted
We have also discovered that there is a performance toll when using InlineUIContainers.
The issue is not related to the use of the data provider. We will address the problem shortly and hopefully, fix it for the upcoming service pack.
Could you share some more details on the UIElements which you are showing in InlineUIContainers, so that we can be sure that we are looking at the same case.
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local="clr-namespace:RTB">
<local:BoolToColorConverter x:Key="BoolToColorConverter"/>
<Style TargetType="local:SmartCodeControl">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:SmartCodeControl">
<Border CornerRadius="4"
BorderBrush="{Binding IsValid, Converter={StaticResource BoolToColorConverter}}" BorderThickness="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<telerik:RadButton Content="Edit" Command="{Binding EditCommand}" Grid.Column="0" VerticalAlignment="Center"/>
<telerik:RadButton Content="Delete" Command="{Binding DeleteCommand}" Grid.Column="1" VerticalAlignment="Center"/>
<TextBox IsReadOnly="True" Text="{Binding Content}" HorizontalAlignment="Stretch" TextWrapping="Wrap" ToolTipService.ToolTip="{Binding Content}" VerticalAlignment="Stretch" Grid.Column="2"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
And here is how we inject the cobtrol in
var selctedCode = (SmartCodeServiceType)listBox.SelectedValue;
ISmartCodeService service = ViewModel.AddService(selctedCode);
Paragraph p1 = new Paragraph();
var control = new SmartCodeControl();
control.DataContext = service;
InlineUIContainer container = new InlineUIContainer();
container.UiElement = control;
container.Width = AssociatedObject.ActualWidth - 20;
container.Height = 25;
p1.Inlines.Add(container);
var parent = AssociatedObject.Document.CaretPosition.GetCurrentParagraphBox().AssociatedParagraph.Parent;
if (parent is Section)
{
((Section)parent).Blocks.AddAfter(AssociatedObject.Document.CaretPosition.GetCurrentParagraphBox().AssociatedParagraph, p1);
}
else
{
AssociatedObject.Document.Sections.Last().Blocks.Add(p1);
}
AssociatedObject.UpdateEditorLayout();
container.Height = control.ActualHeight + 4;
Hope this helps.
Thank you for the follow-up. We managed to reproduce the issue and are considering the implementation of Xaml ExportSettings, which can prevent the serialization of InlineUIContainters and let the user serialize the content of the document.
Please refer to this forum thread for more details.
Iva Toteva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>