Hello. There is a form on the form there are several TextBoxes with ToolTip. And there is a folder with XML files they look like this

A.xml file

<?xml version='1.0' encoding='utf-8'?><Root><Statya><Termin>Австралия</Termin></Statya><Statya><Termin>Африка</Termin></Statya><Root> 

B.xml file

 <?xml version='1.0' encoding='utf-8'?><Root><Statya><Termin>Бельгия</Termin></Statya><Statya><Termin>Болгария</Termin></Statya><Root> 

How to correctly read these files in a folder and in Content ToolTip to substitute different text on a position from these files?

That is, there is the first TextBox in its ToolTip to bring up Australia, there are other TextBox and in its ToolTip to bring out Belgium, etc.

    1 answer 1

    First, we extract the data from the file to the collection using LINQ:

     XElement main = XElement.Load(@"from.xml"); var terms = main .Descendants("Statya") .Descendants("Termin") .Select(x => x.Value) .ToArray(); 

    Now that the list of strings with the values ​​of the elements is stored in the collection, set the values ​​of the hints for the ToolTip collection.

     // Выполнить для каждой подсказки for (int i = 0; i < amount; i++) { tooltips[i].Content = terms[i]; } 

    where tooltips is a collection of hints for those controls that need to be updated.