Cómo configurar la imagen de fondo en el menú MasterDetailPage sin RelativeLayout y AbsoluteLayout . También probé con Grid y AbsoluteLayout pero no funciona. ¿Alguna solución para este problema?
BackgroundImageSource="background.png"
tampoco funciona.
Mi xaml:
<MasterDetailPage.Master>
<ContentPage Title="Menu" BackgroundColor="White"
Icon="hamburger.png">
<StackLayout Orientation="Vertical" >
<StackLayout x:Name="navigationDrawerList"
VerticalOptions="Fill">
<BindableLayout.ItemTemplate>
<DataTemplate>
<StackLayout>
<StackLayout VerticalOptions="FillAndExpand"
Orientation="Horizontal"
Padding="20,0,0,0"
Spacing="20">
<Label Text="{Binding Title}"
FontSize="Medium"
VerticalOptions="Center"
TextColor="Gray" />
</StackLayout>
</StackLayout>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
<StackLayout VerticalOptions="FillAndExpand"
Orientation="Horizontal"
Padding="50,2,0,2"
Spacing="20">
<Label Text="About Us"
FontSize="Medium"
VerticalOptions="Center"
TextColor="Gray" />
</StackLayout>
<StackLayout VerticalOptions="FillAndExpand"
Orientation="Horizontal"
Padding="50,2,0,2"
Spacing="20">
<Label Text="FAQ"
FontSize="Medium"
VerticalOptions="Center"
TextColor="Gray" />
</StackLayout>
</StackLayout>
</ContentPage>
</MasterDetailPage.Master>
2 respuestas
Si envuelve su contenido MasterDetailPage dentro de una cuadrícula anidada, la imagen y el contenido se superpondrán entre sí, creando el efecto de fondo que está buscando
<MasterDetailPage.Master>
<ContentPage Title="Menu" BackgroundColor="White"
Icon="hamburger.png">
<Grid>
<Grid VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Image Source="background.png" Aspect="AspectFill"></Image>
</Grid>
<Grid>
//Your MasterDetailPage content
</Grid>
</Grid>
</ContentPage>
</MasterDetailPage.Master>
Pruebe esto, debe establecer su color de fondo como transparente para establecer una imagen de fondo. El truco funcionó para mí, espero que funcione para ti también
<MasterDetailPage.Master>
<ContentPage Title="Menu"
BackgroundColor="Transparent"
BackgroundImage="hamburger.png">
//Your xaml
</ContentPage>
</MasterDetailPage.Master>
Nuevas preguntas
c#
C # (pronunciado "see sharp") es un lenguaje de programación multi-paradigma de alto nivel, estáticamente tipado desarrollado por Microsoft. El código C # generalmente se dirige a la familia de herramientas y tiempos de ejecución .NET de Microsoft, que incluyen .NET Framework, .NET Core y Xamarin, entre otros. Use esta etiqueta para preguntas sobre el código escrito en las especificaciones formales de C # o C #.