Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows desktop devices.
2,994 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How can we fix web view blink issue?
XAML code
util:WebViewCustomProperties.HtmlContent="{Binding CourseDescription}"
WebViewCustomProperties Class
// "HtmlContent" attached property for a WebView
public static readonly DependencyProperty HtmlContentProperty =
DependencyProperty.RegisterAttached("HtmlContent", typeof(string), typeof(WebViewCustomProperties), new PropertyMetadata("", OnHtmlHtmlContentChanged));
// Getter and Setter
public static string GetHtmlContent(DependencyObject obj) { return (string)obj.GetValue(HtmlContentProperty); }
public static void SetHtmlContent(DependencyObject obj, string value) { obj.SetValue(HtmlContentProperty, value); }
// Handler for property changes in the DataContext : set the WebView
private static void OnHtmlHtmlContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
WebView wv = d as WebView;
if (wv != null)
{
wv.NavigateToString((string)e.NewValue);
}
}
Issue Video
Hello,
Welcome to our Microsoft Q&A platform!
WebView
page blink may be an animation issue. You can try to disable the transition animation between pages to solve.
MyFrame.Navigate(typeof(WebViewPage), null, new SuppressNavigationTransitionInfo());
If you like page animation, you can try another method:
Create the WebView
in code-behind
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
view = new WebView(WebViewExecutionMode.SameThread);
MyGrid.Children.Add(view);
var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/MyPage.html"));
string content = await FileIO.ReadTextAsync(file);
view.NavigateToString(content);
}
It can also fix the problem of page blink, you can choose as needed.
Thanks