Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Followers 0
Login Register as User


20.01.2021 (👁8677)



Wohin navigiert der neue WebBrowser Control in UWP WinUI3, wenn man die Methode .NavigateToString(String_URL) einträgt?



Das Browser Control WebView2 gibt dann nur den String aus. Dadurch kann man plain HTML anzeigen




String sURL = addressBar.Text;










C# Code, WebView2 Universal Windows with WebView2.NavigateToString


using System;

using System.Collections.Generic;

using System.IO;

using System.Linq;

using System.Runtime.InteropServices.WindowsRuntime;

using Windows.Foundation;

using Windows.Foundation.Collections;

using Microsoft.UI.Xaml;

using Microsoft.UI.Xaml.Controls;

using Microsoft.Web.WebView2.Core;

using Windows.UI.Popups;

namespace Uwp_webControl


    /// <summary>

    /// An empty page that can be used on its own or navigated to within a Frame.

    /// </summary>

    public sealed partial class MainPage : Page


        public MainPage()




        #region ====< Buttons >=====

        private async void btnBrowse_Click(object sender, RoutedEventArgs e)




                //----< Navigate Browser >----

                //Uri targetUri = new Uri(addressBar.Text);

                //webView2.Source = targetUri;


                String sURL = addressBar.Text;


                //----</ Navigate Browser >----


            catch (FormatException ex)


                // Incorrect address entered.

                await new MessageDialog("Incorrect address entered.", "UR Address Error").ShowAsync(); ;



        #endregion ====</ Buttons >=====







MainPage xaml










    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">



            <RowDefinition Height="Auto" />

            <RowDefinition Height="*" />



            <ColumnDefinition Width="*" />

            <ColumnDefinition Width="Auto" />


        <TextBox Name="addressBar" Grid.Column="0"/>

        <Button x:Name="btnBrowse" Grid.Column="1" Click="btnBrowse_Click">Go</Button>


        <WebView2 x:Name="webView2"  Grid.Row="1" Grid.ColumnSpan="2"

        Source="" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />