This is the question I had posted. Now, I am not able to reflect the changes made to the rectangle element in the DataTemplate. I want to scaleX the rectangle depending on some values and conditions in the code-behind. I did the following :
foreach (var rectangle in FindVisualChildren<Rectangle>(this))
{
if (rectangle.Name == "rectangleBarChart" && isRectangle == false)
{
rectangle.Fill = Brushes.MediumVioletRed;
rectangle.Height = 10;
rectangle.LayoutTransform = new ScaleTransform(2, 1);
isRectangle = true;
}
}
But, the changes are not reflected, it uses the same old DataTemplate. Any hints to refelct the changes to the UI ?