Inside in my application I log the controls which are used by the user of the application. By used I mean: checking a checkbox or changing the text in a textbox. The controls with input are saved to a database when user logs off. To identify the controls (UIElement) I already save their name and the uid property. But in some cases (when controls are dynamically created) they dont have a value for name/uid. So for this case I'm looking for a third unique identifier.
I looked at the UIElement binding source object name but this object name can be equal for different UIElements so it won't work. I also looked at AutomationId but this id needs to be set, so this is not an option. Hashcode was another option but it is only for a session, so this also wouldn't work.
I found the described options here: Is there any unique identifier for wpf UIElement?
Is there another way / property to uniquely identify a UIElement (without setting this property)?