We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Adding stamps to custom stamp bar problem

Hi,
I am adding stamps programatically to the custom stamp bar. This works fine, BUT

The last shown menuItem is always an empty one. This empty one I have not added and also checking the items of the custom stamp bar, it is not in the items.

Bild2.jpg

Problem is, that if a user clicks on this empty item, the apllication crashes because of a null reference.

Can I delete this empty item, or can I catch that exception?

Kind regards


1 Reply

RB Rajavignesh BalaSankar Syncfusion Team December 20, 2022 04:27 AM UTC

Marco, With the provided details, the reported issue can be reproduced on our end when values are not set for the properties width, height, and source of the image. Please use the below code snippet and shared sample to overcome this null reference exception.

 

image.Source = BitmapImage

If image.Width.Equals(Double.NaN) AndAlso image.Height.Equals(Double.NaN) Then

      image.Height = image.Source.Height

      image.Width = image.Source.Width

End If



Attachment: PdfViewerWPF_56f58024_8b225f69.zip

Loader.
Live Chat Icon For mobile
Up arrow icon