This is a migrated thread and some comments may be shown as answers.

XamlDataProvider is slow

3 Answers 39 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Sergey
Top achievements
Rank 1
Sergey asked on 22 Nov 2011, 11:48 PM
Hello,
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

Sort by
0
Iva Toteva
Telerik team
answered on 23 Nov 2011, 04:56 PM
Hi Sergey,

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.

All the best,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Sergey
Top achievements
Rank 1
answered on 01 Dec 2011, 03:25 PM
Sure, I'd be glad to help.  Here is the control and sample code I use:
<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.



0
Iva Toteva
Telerik team
answered on 06 Dec 2011, 05:12 PM
Hi Sergey,

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.

Kind regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Sergey
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Sergey
Top achievements
Rank 1
Share this question
or