Hello,
I'm trying to use RichTextBox to browse docx files from local file system in out of browser application. Performance of the control is good, but memory footprint observed through the Task Manager keeps growing if I keep opening the same set of files repeatedly. Telerik binaries are Q2 2013. RichTextBox is used in read-only mode.
Is there any way to avoid this issue or "reset" existing control to free memory?
Thanks,
Victor
XAML:
<Grid Background="White" >
<Grid.RowDefinitions>
<RowDefinition Height="21"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Name="SubMenu" Orientation="Horizontal" Background="LightGray">
<TextBlock Text="{Binding SelectedDocumentName}" HorizontalAlignment="Center"/>
</StackPanel>
<telerik:RadRichTextBox x:Name="RadRichTextBox" Grid.Row="2" IsReadOnly="True"
VerticalScrollBarVisibility="Hidden"/>
</Grid>
In code behind:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
IReferenceDocumentsViewModel vm = KernelManager.KernelInstance.Get<IReferenceDocumentsViewModel>();
DataContext = vm;
((INotifyPropertyChanged)vm).PropertyChanged += new PropertyChangedEventHandler(LoadDocument);
}
void LoadDocument(object source, PropertyChangedEventArgs args)
{
if (args.PropertyName.CompareTo("SelectedFile") == 0)
{
using (Stream stream = File.OpenRead(((IReferenceDocumentsViewModel)DataContext).SelectedFile))
{
RadDocument document = null;
IDocumentFormatProvider provider = new DocxFormatProvider();
document = provider.Import(stream);
RadRichTextBox.Document = document;
}
}
}
I'm trying to use RichTextBox to browse docx files from local file system in out of browser application. Performance of the control is good, but memory footprint observed through the Task Manager keeps growing if I keep opening the same set of files repeatedly. Telerik binaries are Q2 2013. RichTextBox is used in read-only mode.
Is there any way to avoid this issue or "reset" existing control to free memory?
Thanks,
Victor
XAML:
<Grid Background="White" >
<Grid.RowDefinitions>
<RowDefinition Height="21"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Name="SubMenu" Orientation="Horizontal" Background="LightGray">
<TextBlock Text="{Binding SelectedDocumentName}" HorizontalAlignment="Center"/>
</StackPanel>
<telerik:RadRichTextBox x:Name="RadRichTextBox" Grid.Row="2" IsReadOnly="True"
VerticalScrollBarVisibility="Hidden"/>
</Grid>
In code behind:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
IReferenceDocumentsViewModel vm = KernelManager.KernelInstance.Get<IReferenceDocumentsViewModel>();
DataContext = vm;
((INotifyPropertyChanged)vm).PropertyChanged += new PropertyChangedEventHandler(LoadDocument);
}
void LoadDocument(object source, PropertyChangedEventArgs args)
{
{
using (Stream stream = File.OpenRead(((IReferenceDocumentsViewModel)DataContext).SelectedFile))
{
RadDocument document = null;
IDocumentFormatProvider provider = new DocxFormatProvider();
document = provider.Import(stream);
RadRichTextBox.Document = document;
}
}
}