This was reported in the Code11 and Code39 symbologies.
In the old RadBarcode39 and RadBarcode11 controls the minimum width where the barcode cannot be read any longer is around 180px in the specific scenario.
In the new RadBarcode and its Code11 and Code39 symbologies, the minimum width is different - around 270px. This reproduces when the SizingMode of the symbology is set to Stretch.
To work this around, you can set the SizingMode of the symbology to Snap. Or alternatively, you can use a bigger Width value for the barcode control, and then apply a ScaleTransform to resize it to the smaller size.
private void RadBarcode_Loaded(object sender, RoutedEventArgs e)
{
var barcode = (RadBarcode)sender;
var desiredWidth = 250;
double relativeWidthDelta = desiredWidth / barcode.ActualWidth;
barcode.LayoutTransform = new ScaleTransform() { ScaleX = relativeWidthDelta };
}
If you drag the pane from one RadDocking element to another, the ActivePane of the docking that started the drag operation is not cleared. The ActivePane should be updated (set to null, or updated in accordance to the PaneActivationMode setting) because the corresponding pane is no longer in this RadDocking instance.
To work this around, you can subscribe to and manually update the ActivePane property.
private void RadDocking_LayoutChangeEnded(object? sender, EventArgs e)
{
var docking = (RadDocking)sender;
if (docking.ActivePane != null && !docking.Panes.OfType<RadPane>().Contains(docking.ActivePane))
{
docking.ActivePane = null;
}
}
When the RadGridView is filtered you can get all items in the data view using the Items collection property of the control. The count can be accessed with the gridView.Items.Count property.
If the RadGridView is grouped and then filtered, the Items.Count no longer returns the correct value. The count doesn't take into account the items that are in collapsed groups. Instead the count contains only the expanded group objects.
To work this around, use the following code instead of gridView.Items.Count.
int count = gridView.Items.OfType<object>().Count();
When the RadScheduleView has a recurring appointment with no end date for its recurrence in certain scenarios multiple errors can be try/catch-ed internally, which leads to a degraded performance. One such scenario is when a recurring appointment with no end date starts before the currently displayed time period, but does not have any occurrences before the displayed time period.
As a workaround, an end date can be added to the recurrence rule of recurring appointments.
ArgumentException is thrown on mouse up, after using the DrawTool or ShapeTool in RadImageEditor or RadImageEditorUI.
The exception message is: "'∞' is not a valid value for property 'Width'."
The stacktrace is:
System.ArgumentException: '8' is not a valid value for property 'Width'. at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at Telerik.Windows.Media.Imaging.Commands.DrawCommand.Execute(RadBitmap source, Object context) at Telerik.Windows.Media.Imaging.History.ImageHistory.Execute(IImageCommand command, Object context) at Telerik.Windows.Controls.RadImageEditor.ExecuteCommand(IImageCommand command, Object context) at Telerik.Windows.Controls.RadImageEditor.CommitTool(Boolean executeSameToolAfterCommit) at Telerik.Windows.Media.Imaging.Tools.DrawToolBase.InvokeEndDraw(Point point) at Telerik.Windows.Media.Imaging.Tools.DrawToolBase.DrawingCanvas_MouseLeftButtonUp(Object sender, MouseButtonEventArgs e)
To work this around, you can create a custom DrawCommand based on the code from the default one and then replace it in the ShapeTool and DrawTool.
public class CustomDrawTool : DrawTool
{
public override IImageCommand GetCommand()
{
return new CustomDrawCommand();
}
}
public class CustomShapeTool : ShapeTool
{
public override IImageCommand GetCommand()
{
return new CustomDrawCommand();
}
}
public class CustomDrawCommand : IImageCommand
{
public RadBitmap Execute(RadBitmap source, object context)
{
DrawCommandContext drawCommandContext = context as DrawCommandContext;
if (drawCommandContext == null || drawCommandContext.DrawnPath == null)
{
return source;
}
Canvas canvas = new Canvas();
canvas.ClipToBounds = true;
var dpiXFactor = source.Bitmap.DpiX / 96;
var dpiYFactor = source.Bitmap.DpiY / 96;
double imageWidth = source.Width / dpiXFactor;
if (imageWidth == double.PositiveInfinity)
{
imageWidth = source.Width;
}
double imageHeight = source.Height/ dpiYFactor;
if (imageHeight == double.PositiveInfinity)
{
imageHeight = source.Height;
}
canvas.Children.Add(new System.Windows.Controls.Image()
{
Source = source.Bitmap,
Width = imageWidth,
Height = imageHeight,
});
Panel parent = drawCommandContext.DrawnPath.Parent as Panel;
if (parent != null)
{
parent.Children.Remove(drawCommandContext.DrawnPath);
drawCommandContext.DrawnPath.RenderTransform = new ScaleTransform(1 / dpiXFactor, 1 / dpiYFactor);
canvas.Children.Add(drawCommandContext.DrawnPath);
}
RenderOptions.SetBitmapScalingMode(canvas, BitmapScalingMode.NearestNeighbor);
BitmapSource bitmapSource = this.GetBitmapSource(source.Width, source.Height, canvas, source.Bitmap.DpiX, source.Bitmap.DpiY);
return new RadBitmap(bitmapSource);
}
private BitmapSource GetBitmapSource(int width, int height, Canvas canvas, double dpiX, double dpiY)
{
Size size = new Size(width, height);
canvas.Measure(size);
canvas.Arrange(new Rect(size));
RenderTargetBitmap renderBitmap = new RenderTargetBitmap(width, height, dpiX, dpiY, PixelFormats.Pbgra32);
renderBitmap.Render(canvas);
return renderBitmap;
}
}
<telerik:ImageToolItem ImageKey="Draw" telerik:LocalizationManager.ResourceKey="ImageEditor_Draw" Command="commands:ImageEditorRoutedCommands.ExecuteTool">
<telerik:ImageToolItem.CommandParameter>
<local:CustomDrawTool />
</telerik:ImageToolItem.CommandParameter>
</telerik:ImageToolItem>
Hello,
HtmlDataProvider will throw an exception on export or when used by a RadRichTextBox, when using a html containing the length value "NaN", which doesn't seem to be a standard approved value, but nevetheless it is a special case because other invaild values are simply ignored while this one triggers two exceptions - one of which is hard to catch and crashes the whole application.
Code to reproduce: Console App / .Net Framework 4.8 / Package Telerik.Windows.Documents.FormatProviders.Html.for.Wpf 2022.3.912
using System;
using Telerik.Windows.Documents.FormatProviders.Html;
using Telerik.Windows.Documents.Model;
namespaceHtmlProviderCrash
{
internalclassProgram
{
static void Main(string[] args)
{
var htmlContent = "<img src=\"https://static.cleverpush.com/notification/icon/92fYF7FtKbthsezwS.png?element=Le7adDwC\" " +
"alt=\"\" style=\"display: inline-table;max-width: 100%;width: 300px;\" width=\"300\" height=\"NaN\" class=\"cp-element-image light-img\">";
HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
RadDocument document = htmlProvider.Import(htmlContent);
try
{
var export = htmlProvider.Export(document);
}
catch (Exception ex)
{
var ka = ex.ToString();
}
while (Console.ReadKey().KeyChar != 'x') { }
}
}
}
Message "MeasureOverride returned NaN: Telerik.Windows.Documents.Layout.ImageLayoutBox" string at Telerik.Windows.Documents.Layout.LayoutElement.Measure(SizeF availableSize) at Telerik.Windows.Documents.Layout.ParagraphLayoutBox.MeasureCurrentGroupSize(ParagraphLayoutBoxMeasureContext context, SizeF measureSize, Func`1 GetCurrentXDefaultValue, LinkedList`1 currentGroupInlines) at Telerik.Windows.Documents.Layout.ParagraphLayoutBox.MeasureOverride(SizeF availableSize) at Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(SizeF availableSize) at Telerik.Windows.Documents.Layout.LayoutElement.Measure(SizeF availableSize) at Telerik.Windows.Documents.Layout.SectionLayoutBox.MeasureOverrideInternal(SizeF availableSize) at Telerik.Windows.Documents.Layout.SectionLayoutBox.MeasureOverride(SizeF availableSize) at Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(SizeF availableSize) at Telerik.Windows.Documents.Layout.LayoutElement.Measure(SizeF availableSize) at Telerik.Windows.Documents.Layout.DocumentLayoutBox.MeasureOverrideInternal(SizeF availableSize) at Telerik.Windows.Documents.Layout.DocumentLayoutBox.MeasureOverride(SizeF availableSize) at Telerik.Windows.Documents.Layout.LayoutElement.MeasureCore(SizeF availableSize) at Telerik.Windows.Documents.Layout.LayoutElement.Measure(SizeF availableSize) at Telerik.Windows.Documents.Model.RadDocument.Measure(SizeF measureSize) at Telerik.Windows.Documents.Model.RadDocument.MeasureAndArrangeInDefaultSize() at Telerik.Windows.Documents.Model.RadDocument.EnsureDocumentMeasuredAndArranged() at Telerik.Windows.Documents.FormatProviders.Html.Export.HtmlDocumentExporter.Export(RadDocument document, Stream output) at Telerik.Windows.Documents.FormatProviders.Html.HtmlFormatProvider.Export(RadDocument document, Stream output) at Telerik.Windows.Documents.FormatProviders.Html.HtmlFormatProvider.Export(RadDocument document) at HtmlProviderCrash.Program.Main(String[] args)
Message "The image data generated an overflow during processing"
at System.Windows.Media.Imaging.TransformedBitmap.FinalizeCreation() in System.Windows.Media.Imaging\TransformedBitmap.cs:line 216
at System.Windows.Media.Imaging.TransformedBitmap.EndInit() in System.Windows.Media.Imaging\TransformedBitmap.cs:line 112
at System.Windows.Media.Imaging.BitmapImage.FinalizeCreation() in System.Windows.Media.Imaging\BitmapImage.cs:line 505
at System.Windows.Media.Imaging.BitmapImage.EndInit() in System.Windows.Media.Imaging\BitmapImage.cs:line 319
at Telerik.Windows.Documents.Model.ImageDocumentElementHelper.CreateImageSourceCore(BitmapCreateOptions createOptions, Byte[] bytes, Size renderingSize, String& extension, Byte[]& resultBytes)
at Telerik.Windows.Documents.Model.ImageDocumentElementHelper.CreateImageSource(Byte[] bytes, Size imageSize, Size scaleFactor, String& extension, Byte[]& resultBytes)
at Telerik.Windows.Documents.Model.ImageDocumentElementHelper.InitializeRawImageData(IImageDocumentElement imageElement, Byte[] bytes, Size scaleFactor, String& extension)
at Telerik.Windows.Documents.Model.ImageDocumentElementHelper.InitInternal(IImageDocumentElement imageElement, Byte[] bytes, Size size, String extension, Boolean isUserInitiated)
at Telerik.Windows.Documents.Model.ImageInline.InitImageElementFromUriStream(Stream stream)
at Telerik.Windows.Documents.Model.ImageInline.<SetStreamFromUriSource>b__0(Object s, StreamReadyEventArgs a)
at Telerik.Windows.Documents.Utils.ResourceStreamLocator.OnStreamReady()
at Telerik.Windows.Documents.Utils.ResourceStreamLocator.<GetStreamAsync>b__0(Object sender, OpenReadCompletedEventArgs e)
at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e)
at System.Net.WebClient.OpenReadOperationCompleted(Object arg)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
A SocketException can occur when the ImageInline source is assigned to a link pointing to a picture on a remote server (a website). For example: UriSource ="https://docs.telerik.com/devtools/wpf/knowledge-base/images/kb-chartview-categorical-and-datetime-axis-0.png"
This could happen during the fetching of the image stream. In some cases, the server may give a NetworkStream or ConnectionStream, or similar Stream implementation, which keeps an open connection between the application and the server. If the connection get severed during the stream reading, an exception is thrown.
The exception message is: "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."
The stacktrace is:
Exception Info: System.Net.Sockets.SocketException
at System.Net.Sockets.NetworkStream.Read(Byte[], Int32, Int32)
Inner Exception:
Exception Info: System.IO.IOException
at System.Net.ConnectStream.Read(Byte[], Int32, Int32)
at System.IO.Stream.InternalCopyTo(System.IO.Stream, Int32)
at Telerik.Windows.Documents.Layout.ExtensionMethods.ToMemoryStream(System.IO.Stream)
at Telerik.Windows.Documents.Model.ImageInline.<SetStreamFromUriSource>b__0(System.Object, StreamReadyEventArgs)
at Telerik.Windows.Documents.Utils.ResourceStreamLocator.OnStreamReady()
at System.Net.WebClient.OnOpenReadCompleted(System.Net.OpenReadCompletedEventArgs)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
The selection with the Shift key when SelectionMode=Extended no longer works in the default Nested rendering mode of RadGridView. This reproduces only when the data view is grouped.
To work this around, set the GroupRenderMode property of RadGridView to Flat.
<telerik:RadGridView GroupRenderMode="Flat" />