Share via

Is there a problem with Watermark code?

Rod At Work 871 Reputation points
2021-05-18T14:03:49.667+00:00

@DaisyTian-MSFT I introduced the Watermark code you provided in answer to question I asked The SelectedValue property is never assigned. I don't know what I'm doing wrong. It has worked fine for me. However, one of my colleagues, when trying to implement the watermark, encountered this error:

That looks pretty good, but I get this exception when I add a new record.
"Specified Visual is already a child of another Visual or the root of a CompositionTarget." that's in WatermarkBehavior.cs in OnLoaded method.

I've looked up that error. It looks to me like it happens when some visual element gets introduced more than once into the visual tree. Could that be happening in the OnLoaded method of WatermarkBehavior?

Developer technologies | Windows Presentation Foundation

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.