如何在标题栏中显示图像



我在 xamarin.form 中有一个应用程序,我想在标题栏中显示图像。

我使用了xamarin.form 3.6.0.2。

当我使用navigationpage.titleview并运行应用程序时,它显示错误消息。没有属性标题视图。[构建输出] https://ufile.io/e1rkf


<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:xfx="clr-namespace:Xfx;assembly=Xfx.Controls"
            xmlns:local="clr-namespace:Reports_Rpt;assembly=Reports_Rpt"
            x:Class="Reports_Rpt.Signup">
 <NavigationPage.TitleView>
       <Image Source="{local:ImageResource Reports_Rpt.Images.logo.png}" HorizontalOptions="Start" BackgroundColor="#4B8CA8"></Image>
   </NavigationPage.TitleView>

   <ContentPage.Content>
       <Grid BackgroundColor="White" Padding="2,2,2,2">
           <Grid.RowDefinitions>
               <RowDefinition />
           </Grid.RowDefinitions>
           <xfx:XfxEntry 
                         x:Name="txtName"                         
                         Placeholder="Enter your name"
                         HorizontalOptions="Fill"
                          Grid.Row="0"
                          />
           <xfx:XfxEntry 
                         x:Name="txtContactNum"                         
                         Placeholder="Enter your contact number"
                         HorizontalOptions="Fill"
                          Grid.Row="1"
                          />
       </Grid>
   </ContentPage.Content>
</ContentPage>

 [1]: https://ufile.io/e1rkf

错误已通过更新适用于 android 的 nuget 包解决。

最新更新