I have a class which adds items to a WPF Stackpanel however this does not seem to work instantantly it is working after i have restarted a timer on my page.
Does this need some sort of event to refresh the WPF page and instantly make the changes take effect.
Code: Ellipse myEllipse = new Ellipse(); SolidColorBrush mySolidColorBrush = new SolidColorBrush(); mySolidColorBrush.Color = item.BallColour;
SolidColorBrush myBackGroundTransparent = new SolidColorBrush();
myBackGroundTransparent.Color = Colors.Transparent;
StackPanel myStackPanel = new StackPanel();
myEllipse.Fill = mySolidColorBrush;
myEllipse.StrokeThickness = 2;
myEllipse.Stroke = Brushes.Black;
myEllipse.Width = 50;
myEllipse.Height = 50;
myEllipse.Margin = new Thickness(10, 0, 20, 0);
Label myLabel = new Label();
ResourceDictionary res = (ResourceDictionary)Application
.LoadComponent(new Uri("../Styles/Styles.xaml", UriKind.Relative));
Style style = (Style)res["LittleBallLabel"];
myLabel.Style = style;
myLabel.Content = item.Number;
myEllipse.Tag = myLabel;
CalledNumber1.Children.Add(myEllipse);
theNumber.Children.Add(myLabel);