Forum Discussion

praveenRV's avatar
praveenRV
New Contributor
8 years ago

Identify WPF object uniquely which is best practise.

My application will generate more tree view items where all tree view items is similar i cant able to verify this part unless and untill if we get a unique value to automate. kindly provide me sugges...
  • tristaanogre's avatar
    tristaanogre
    8 years ago

    What I would do then would be to not map, specifically, that object but, in your code, grab it dynamically by creating a function to find it based upon a parameterized text string.  Reference the "FindChild" method.  In looking over the object properties, there is little else that I would trust as being able to give a unique property.  I would suggest using the class name and the ID, but I know ID's sometimes shift and change.

     

    Your other option would be to utilize configurations in your name mapping.  Create a configuration for each locale and change the value of "Text" appropriately for each configuration.