❔ WPF edit Label Content
Hey, I want to set the label on a random position. After this I want to edit the content of the label, buy how can I do that if my label are object or UIElement
Can I replace the label from my canvas with a new label than it's exactly the same with different content?
foreach (var OR UIElement label in RememberScreen.Children)
if (typeof(Label).IsInstanceOfType(label))
{
while (true)
{
// increment i
i++;
// set position from left
posL ......
// set position from top
posT = .....
Debug.WriteLine(posL + " " + posT);
if (oldPosT.Contains(posT) != true)
{
label.Content = $"{i}"; // HERE IS THE ERROR
Canvas.SetLeft(labels[i], posL);
Canvas.SetTop(labels[i], posT);
label.Visibility = Visibility.Visible;
// add the position to the list
oldPosT.Add(posT);
Debug.WriteLine(oldPosT[i]);
break;
}foreach (var OR UIElement label in RememberScreen.Children)
if (typeof(Label).IsInstanceOfType(label))
{
while (true)
{
// increment i
i++;
// set position from left
posL ......
// set position from top
posT = .....
Debug.WriteLine(posL + " " + posT);
if (oldPosT.Contains(posT) != true)
{
label.Content = $"{i}"; // HERE IS THE ERROR
Canvas.SetLeft(labels[i], posL);
Canvas.SetTop(labels[i], posT);
label.Visibility = Visibility.Visible;
// add the position to the list
oldPosT.Add(posT);
Debug.WriteLine(oldPosT[i]);
break;
}Can I replace the label from my canvas with a new label than it's exactly the same with different content?