private void GotoReadyState(object sender, RoutedEventArgs e) { var sut = MainContent.FindFirstChild <Rectangle>(x => x.Name == "SUT"); var colors = new [] { Colors.Blue, Colors.Pink, Colors.Yellow, Colors.Lime }; var color = colors[random.Next(colors.Length)]; sut.Fill = new SolidColorBrush(color); VisualStateManager.GoToState(MainContent, "Ready", true); }
private void GotoReadyState(object sender, RoutedEventArgs e) { //var rootGrid = MainContent.FindFirstChild<Grid>(x => x.Name == "RootGrid"); var webView = MainContent.FindFirstChild <WebView>(x => x.Name == "WebView"); var colors = "Blue,Pink,Yellow,Lime".Split(','); var color = colors[random.Next(colors.Length)]; webView.NavigateToString($@" <html> <body style='background: {color};' /> </html> " ); VisualStateManager.GoToState(MainContent, "Ready", true); }