Hi Team,
We have a large-scale WPF application that uses the Telerik WPF RadGridView across multiple screens. We are experiencing significant memory growth issues. Upon deep analysis of the memory dump, we observed that the RadGridView continuously pushes DispatcherPriority items into the Dispatcher queue. We also noticed an internal timer within the RadGridView that appears to be active even after the control is no longer visible. We would like to understand how to completely detach and stop this internal timer once the control is removed from the screen, and why the RadGridView keeps pushing DispatcherItem entries into the Dispatcher queue.
Telerik Version : 2017.2.503.45
This is not quite a valid PDF file scenario according to PDF file specification. However, we may try handling it in order to show the correct number of pages. When the kid is of type Pages, it should be added to the pages traversal recursion only the first time it is met.
When importing a document containing a single associated widget annotation merged into the field dictionary the field is skipped on import and an exception is thrown.
According to the PDF Specification: Field Dictionaries: Kids:
An array of indirect references to the immediate children of this field.
In a non-terminal field, the Kids array is required to refer to field dictionaries that are immediate descendants of this field. In a terminal field, the Kids array ordinarily must refer to one or more separate widget annotations that are associated with this field. However, if there is only one associated widget annotation, and its contents have been merged into the field dictionary, Kids must be omitted.
Working with the RadContextMenu that comes from the RadRichTextBoxUI, when having analytics enabled, produces a NullReferenceException.
Manually set the Menu property on the PreviewMouseLeftButtonUp event of the RadMenuItem:
static MainWindow()
{
EventManager.RegisterClassHandler(typeof(RadMenuItem), PreviewMouseLeftButtonUpEvent, new MouseButtonEventHandler(OnRadMenuItemPreviewMouseLeftButtonUp), true);
}
private static void OnRadMenuItemPreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
RadMenuItem radMenuItem = (RadMenuItem)sender;
RadContextMenu radContextMenu = radMenuItem.ParentOfType<RadContextMenu>();
if (radContextMenu != null)
{
PropertyInfo menuPropertyInfo = radMenuItem.GetType().GetProperty("Menu", BindingFlags.Public | BindingFlags.Instance);
if (menuPropertyInfo != null)
{
MethodInfo setMethod = menuPropertyInfo.GetSetMethod(true);
if (setMethod != null)
{
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
{
setMethod.Invoke(radMenuItem, new object[] { radContextMenu });
}), System.Windows.Threading.DispatcherPriority.Background);
}
}
}
}
When RadRichTextBox for WPF is hosted in a WinForms application (through ElementHost), typing with Japanese IME duplicates the typed letters, which makes the control unusable with the default behavior. Possible workaround: Create custom caret. There are some suggestions in this forum thread: https://www.telerik.com/forums/richtextbox-doesn't-support-japanese-ime-when-hosted-in-winforms
The selection a RadComboBox hosted in RadDataForm gets cleared on commit changes. This happens when the RadComboBox is added in the EditTemplate and its IsEditable is set to True. Committing the edit clears the TextBox of the ComboBox, which clears the selection.
To work this around, subscribe to the EditEnding event of RadDataForm and clear the DataContext of the RadComboBox element.
private void RadDataForm_EditEnding(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndingEventArgs e)
{
var dataForm = (RadDataForm)sender;
var myField = dataForm.ChildrenOfType<DataFormDataField>().FirstOrDefault(df => df.Name == "myField");
if (myField != null)
{
var comboBox = (RadComboBox)myField.Content;
comboBox.DataContext = null;
}
}
TypeAccessException occurs in .NET Framework projects when using internal class for the data point models. The error doesn't occur in .NET 8 projects.
dsa
System.TypeAccessException: 'Attempt by method 'DynamicClass.Telerik_DynamicGetter_Argument(System.Object)' to access type 'WpfApp29.ChartPoint' failed.' at Telerik.Windows.Controls.Chart.dll!Telerik.Windows.Controls.ChartView.PropertyNameDataPointBinding.GetValue(object instance) Telerik.Windows.Controls.Chart.dll!Telerik.Windows.Controls.ChartView.ScatterSeriesDataSource.InitializeBinding(Telerik.Windows.Controls.ChartView.DataPointBindingEntry binding) Telerik.Windows.Controls.Chart.dll!Telerik.Windows.Controls.ChartView.ChartSeriesDataSource.GenerateDataPoint(object dataItem, int index) Telerik.Windows.Controls.Chart.dll!Telerik.Windows.Controls.ChartView.ChartSeriesDataSource.BindCore(System.Collections.IEnumerable source)
Telerik.Windows.Controls.Chart.dll!Telerik.Windows.Controls.ChartView.ChartSeriesDataSource.Bind(System.Collections.IEnumerable itemSource)
Telerik.Windows.Controls.Chart.dll!Telerik.Windows.Controls.ChartView.ChartSeriesDataSource.Rebind(System.Collections.IEnumerable oldSource, System.Collections.IEnumerable newSource, bool shouldUpdateSelectedPoints) Telerik.Windows.Controls.Chart.dll!Telerik.Windows.Controls.ChartView.ChartSeriesDataSource.ItemsSource.set(System.Collections.IEnumerable value) Telerik.Windows.Controls.Chart.dll!Telerik.Windows.Controls.ChartView.ChartSeries.InitDataBinding() Line Telerik.Windows.Controls.Chart.dll!Telerik.Windows.Controls.ChartView.ScatterPointSeries.InitDataBinding() Telerik.Windows.Controls.Chart.dll!Telerik.Windows.Controls.ChartView.ChartSeries.OnApplyTemplate() Telerik.Windows.Controls.Chart.dll!Telerik.Windows.Controls.ChartView.PointTemplateSeries.OnApplyTemplate()
To work this around, upgrade the target framework of the project to .NET 8. Or use the GenericDataPointBinding class for the binding properties of the series (XValueBinding, YValueBinding, etc.), instead of the default PropertyNameDataPointBinding.
NullReferenceException thrown on opening the CompletionListWindow when RadSyntaxEditor is hosted in a non-WPF application (usually WinForms) and there are no WPF Application and MainWindow initialized.
This can happen if the RadSyntaxEditor for WPF is hosted in a WinForms application. In this scenario the System.Windows.Application.Current and its MainWindow are not initialized, which is what the IntelliPrompt positioning logic relies on.
Exception details:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
> Telerik.Windows.Controls.SyntaxEditor.dll!Telerik.Windows.Controls.SyntaxEditor.UI.IntelliPromptBase.SetPosition(System.Windows.Point pointInScreen) Line 452 C# Telerik.Windows.Controls.SyntaxEditor.dll!Telerik.Windows.Controls.SyntaxEditor.UI.IntelliPromptBase.SetPosition(System.Windows.Point pointInEditorPresenter, System.Windows.Point pointAboveTheCaret) Line 442 C# Telerik.Windows.Controls.SyntaxEditor.dll!Telerik.Windows.Controls.SyntaxEditor.UI.IntelliPromptBase.SetPositionInView() Line 480 C# Telerik.Windows.Controls.SyntaxEditor.dll!Telerik.Windows.Controls.SyntaxEditor.UI.IntelliPromptBase.InitializeIntellisense() Line 401 C# Telerik.Windows.Controls.SyntaxEditor.dll!Telerik.Windows.Controls.SyntaxEditor.UI.IntelliPromptBase.Show(Telerik.Windows.Controls.SyntaxEditor.UI.CaretPosition caretStartPosition, Telerik.Windows.Controls.SyntaxEditor.UI.CaretPosition caretEndPositions) Line 211 C#
Telerik.Windows.Controls.SyntaxEditor.dll!Telerik.Windows.Controls.SyntaxEditor.UI.IntelliPromptBase.Show() Line 182 C#To work this around, you can initialize a new WPF application and MainWindow and create a hidden HwndSource for the MainWindow. This should happen before showing the WPF content in the WinForms application's code.
public Form1()
{
InitializeComponent();
new System.Windows.Application();
System.Windows.Application.Current.MainWindow = new System.Windows.Window();
var parameters = new HwndSourceParameters("HiddenHost")
{
Width = 1, Height = 1,
WindowStyle = unchecked((int)0x80000000) // WS_POPUP | WS_EX_NOACTIVATE
};
var hwndSource = new HwndSource(parameters);
hwndSource.RootVisual = System.Windows.Application.Current.MainWindow;
// other code here
ElementHost host = new ElementHost { Dock = DockStyle.Fill };
host.Child = wpfControl
this.Controls.Add(host);
}
Pressing the Enter key when a field editor is focused will scroll the vertical scrollbar to the topmost offset. This is reproducible when the properties are grouped. Also, the RenderMode should be set to Flat.
To work this around, change the RenderMode setting to Hierarchical right before the Enter key logic is executed and then return it back to Flat after some time.
private void RadPropertyGrid_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
var propertyGrid = (RadPropertyGrid)sender;
var currentMode = propertyGrid1.RenderMode;
propertyGrid.RenderMode = RenderMode.Hierarchical;
Dispatcher.BeginInvoke(new Action(() =>
{
propertyGrid.RenderMode = currentMode;
}));
}
The RichTextBox internal logic that imports .docx documents (DocxFormatProvider) doesn't support elements that don't need direct content, but have both start and end tags. Instead such elements should use self-closing tags.
For example, instead of <w:vertAlign w:val="baseline"></w:vertAlign> it should be <w:vertAlign w:val="baseline"/>
When such element is read during import, issues may occur. Two main known issues here are with the w:vertAlign and Relationship tags.
Using
<w:vertAlign w:val="baseline"></w:vertAlign> instead of
<w:vertAlign w:val="baseline"/> throws NullReferenceException with the following stack trace:
System.NullReferenceException: 'Object reference not set to an instance of an object.' Telerik.Windows.Documents.FormatProviders.OpenXml.dll!Telerik.Windows.Documents.FormatProviders.OpenXml.OpenXmlHelper.ConvertStringToBaselineAlignment(string value) Line 168 C# Telerik.Windows.Documents.FormatProviders.OpenXml.dll!Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.SpanStyleImporter.ReadBaselineAlignment(Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Parsing.Style style) Line 243 C# Telerik.Windows.Documents.FormatProviders.OpenXml.dll!Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.SpanStyleImporter.ReadStyle(Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Parsing.Style style) Line 88 C# Telerik.Windows.Documents.FormatProviders.OpenXml.dll!Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.StyleDefinitionsImporter.ReadSpanStyleProperties(Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Parsing.Style style) Line 278 C# Telerik.Windows.Documents.FormatProviders.OpenXml.dll!Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.StyleDefinitionsImporter.ReadStyle() Line 188 C# Telerik.Windows.Documents.FormatProviders.OpenXml.dll!Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.StyleDefinitionsImporter.Import() Line 67 C# Telerik.Windows.Documents.FormatProviders.OpenXml.dll!Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.ReadXmlContentFromPackage(Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxPartImporterBase importer) Line 430 C# Telerik.Windows.Documents.FormatProviders.OpenXml.dll!Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.ReadXmlContentAndRelationsFromPackage(Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxPartImporterBase importer) Line 406 C# Telerik.Windows.Documents.FormatProviders.OpenXml.dll!Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.Import() Line 190 C# Telerik.Windows.Documents.FormatProviders.OpenXml.dll!Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider.Import(System.IO.Stream input) Line 147 C# Telerik.Windows.Documents.dll!Telerik.Windows.Documents.FormatProviders.DocumentFormatProviderBase.Import(byte[] input) Line 90 C#
Using
<Relationship Id="rId00004" Target="styles.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"></Relationship> instead of
<Relationship Id="rId00004" Target="styles.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"/> throws KeyNotFoundException with the following stack trace:
KeyNotFoundException: The given key was not present in the dictionary.
System.ThrowHelper.ThrowKeyNotFoundException() in ThrowHelper.cs
System.Collections.Generic.Dictionary<TKey, TValue>.this[TKey].get(TKey) in Dictionary.cs
Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.PartRelationsImporter.GetRelationByID(string) in PartRelationsImporter.cs
Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.GetRelationByID(string) in DocxImporter.cs
Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.MainDocumentImporter.BuildSection() in MainDocumentImporter.cs
Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.MainDocumentImporter.BuildBody() in MainDocumentImporter.cs
Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.MainDocumentImporter.BuildDocument() in MainDocumentImporter.cs
Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.MainDocumentImporter.Import() in MainDocumentImporter.cs
Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.ReadXmlContentFromPackage(Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxPartImporterBase) in DocxImporter.cs
Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxImporter.ReadXmlContentAndRelationsFromPackage(Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.Import.DocxPartImporterBase) in DocxImporter.cs
To work this around, import the document with the WordsProcessing library. If you need to display it in RadRichTextBox, you can export it again using the WordsProcessing library. This will normalize the tags. Then import it again using the RadDocument's DocxFormatProvider.
var dplDocxFormatProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
RadFlowDocument flowDocument = dplDocxFormatProvider.Import(File.ReadAllBytes("../../../test.docx"), null);
var docBytes = dplDocxFormatProvider.Export(flowDocument, null);
File.WriteAllBytes("../../../modified-doc.docx", docBytes);
var rtbDocxFormatProvider= new Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider();
RadDocument document = rtbDocxFormatProvider.Import(File.ReadAllBytes("../../../modified-doc.docx"));
Document exported to DOCX with 2025 Q2 cannot be opened by 2025 Q1 or previous versions.
Workaround: Use document processing to fix the document.
var processing_provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
var document = processing_provider.Import(File.ReadAllBytes("C:\\Users\\test\\Downloads\\word1.docx"),null);
var bytes_ = processing_provider.Export(document, null);
var rtb_provider = new Telerik.Windows.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider();
var doc = rtb_provider.Import(bytes_);
radRichTextBox.Document = doc;