Help correcting tab header

Mark Mather 156 Reputation points
2020-05-03T19:30:30.743+00:00

I need help correcting the tabview tab header title and the Website Icon isn't showing up

7856-tab.png

Right now I seeing this

7857-tab2.png

private void Neutron_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)  
        {  
            if (args.IsSuccess == true)  
            {  
                StatusTextBox.Text = " completed successfully.";  
                Tabs.Header = args.Uri.ToString();  
            }  
            else  
            {  
                StatusTextBox.Text = "Navigation to: " + args.Uri.ToString() +  
                                       " failed with error " + args.WebErrorStatus.ToString();  
  
            }  
        }  
  
        }  
    }  
Universal Windows Platform (UWP)
0 comments No comments
{count} votes

Accepted answer
  1. Mark Mather 156 Reputation points
    2020-05-03T20:41:49.797+00:00

    here is the code i don't think I named it

    <Page
        x:Class="Frost.Browser2"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:Frost"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
        mc:Ignorable="d"
        Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    
    
        <Grid>
    
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
    
            <controls:TabView x:Name="TabViewItem"
    
                          TabWidthBehavior="Equal"
                          CanCloseTabs="True"
                          IsCloseButtonOverlay="False"
                          CanDragItems="True"
                          CanReorderItems="False"
                          AllowDrop="False"
                          SelectedTabWidth="200" Margin="0,60,0,0" TabNavigation="Local" TabFocusNavigation="Local">
    
                <controls:TabView.Resources>
    
                    <x:Double x:Key="TabViewItemHeaderMinHeight">40</x:Double>
                    <x:Double x:Key="TabViewItemHeaderMinWidth">55</x:Double>
                    <x:Double x:Key="TabViewItemHeaderMaxWidth">200</x:Double>
    
                </controls:TabView.Resources>
    
    
                <controls:TabView.TabStartHeader>
    
                    <Button Width="48"
                    Height="{StaticResource TabViewItemHeaderMinHeight}"
                    Margin="0,0,-1,0"
                    BorderThickness="1"
                    Background="Transparent" 
                    Style="{StaticResource ButtonRevealStyle}" 
                    Padding="2,2,0,0">
                        <Viewbox MaxWidth="16" MaxHeight="16">
                            <SymbolIcon Symbol="OpenPane"/>
                        </Viewbox>
                    </Button>
                </controls:TabView.TabStartHeader>
    
                <!-- Tabs -->
                <controls:TabViewItem 
    
                    Header="Home" Icon="Home" ManipulationMode="ScaleInertia" CanDrag="True">
                    <WebView x:Name="Neutron" ContentLoading="Neutron_ContentLoading" DOMContentLoaded="Neutron_DOMContentLoaded" NavigationCompleted="Neutron_NavigationCompleted" />
    
                </controls:TabViewItem>
    
    
                <controls:TabView.TabActionHeader>
                    <Button x:Name="AddTabButtonUpper"
                    Width="48"
                    Height="{StaticResource TabViewItemHeaderMinHeight}"
                    Margin="-1,0,0,0"
                    BorderThickness="1"
                    Background="Transparent"
                    Style="{StaticResource ButtonRevealStyle}">
                        <Viewbox MaxWidth="16"
                        MaxHeight="16">
                            <FontIcon FontFamily="Segoe MDL2 Assets"
                          Glyph="&#xE710;" />
                        </Viewbox>
                    </Button>
    
                </controls:TabView.TabActionHeader>
    
    
    
                <controls:TabView.Footer>
                    <TextBlock x:Name="StatusTextBox" Padding="12,8,12,8"
                       HorizontalAlignment="Left"
                       FontSize="12" FontWeight="Bold"
                       Text="Ready" />
    
                </controls:TabView.Footer>
    
            </controls:TabView>
    
            <Button Content="&#xE0A6;" FontFamily="Segoe MDL2 Assets" Margin="10,10,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.371,0.344" RequestedTheme="Default" Height="32" Width="42" Background="White"/>
            <Button Content="" FontFamily="Segoe MDL2 Assets" Margin="57,10,0,0" VerticalAlignment="Top" Height="32" Width="42" Background="#33E8E8E8"/>
            <Button Content="&#xE117;" FontFamily="Segoe MDL2 Assets" Margin="104,11,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.485,0.852" Height="31" Width="45" Background="#33FDFDFD"/>
            <TextBox HorizontalAlignment="Left" Margin="204,10,0,0" Text="" TextWrapping="Wrap" VerticalAlignment="Top" Width="1330" PlaceholderText="Enter Address" AllowDrop="True" BackgroundSizing="InnerBorderEdge" ElementSoundMode="Default" KeyDown="TextBox_KeyDown" Height="31"/>
            <Button Content="&#xE10F;" FontFamily="Segoe MDL2 Assets" Margin="154,11,0,0" VerticalAlignment="Top" RenderTransformOrigin="-0.485,0.852" Height="31" Width="45" Background="#33FFFFFF"/>
            <Button Content="&#xE712;" FontFamily="Segoe MDL2 Assets" Margin="0,11,10,0" VerticalAlignment="Top" RenderTransformOrigin="-0.485,0.852" Height="31" Width="45" HorizontalAlignment="Right" Background="#33EEEEEE">
    
            </Button>
    
        </Grid>
    </Page>
    

3 additional answers

Sort by: Most helpful
  1. Mark Mather 156 Reputation points
    2020-05-03T19:32:58.593+00:00
      <controls:TabViewItem 
    
                    Header="Home" Icon="Home" ManipulationMode="ScaleInertia" CanDrag="True">
                    <WebView x:Name="Neutron" ContentLoading="Neutron_ContentLoading" DOMContentLoaded="Neutron_DOMContentLoaded" NavigationCompleted="Neutron_NavigationCompleted" />
    
                </controls:TabViewItem>
    
    0 comments No comments

  2. Daniele 1,996 Reputation points
    2020-05-03T20:28:39.703+00:00

    Change the control name to TabView to give it a more correct name, here the XAML

    <controls:TabView x:Name="TabView"
    

    then use this

    private void Neutron_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
    {
        if (args.IsSuccess)
        {
            var selectedTabViewItem = (TabViewItem) TabView.SelectedItem;
            if (selectedTabViewItem == null) return;
            selectedTabViewItem.Header = args.Uri.ToString();
            selectedTabViewItem.Icon = new SymbolIcon(Symbol.Accept);
        }
    }
    

    To fill "selectedTabViewItem.Icon" you can use an instance of classes BitmapIcon, FontIcon, IconSourceElement, PathIcon, SymbolIcon depending what you want to show.

    0 comments No comments

  3. Mark Mather 156 Reputation points
    2020-05-03T20:37:09.677+00:00

    Im getting this error

    7825-tab3.png

    These are the options I'm getting while trying to fix, also how do you in example make it say "icon" facebook

    7787-tab4.png