How would I go about converting a UIElement
to a, in this problem, CartesianChart
(LiveCharts).
In this code, I check for a Grid for a CartesianChart
and then I want to store it (in ch
).
CartesianChart ch;
for (int i = 0; i < Grid.Children.Count; i++)
{
var temp = Grid.Children[i].GetType();
if (temp.Name == "CartesianChart")
{
ch = Grid.Children[i];
}
}
ch.Name = "Chart";
ch.Margin = new Thickness(0, 0, 250, 125);
ch.Series = new SeriesCollection
It says are you missing a cast?
, but I'm unsure of how to cast a UIElement
to an Object
.