Partial views, filling up UI

This commit is contained in:
2025-08-17 17:47:32 +02:00
parent eac181fa63
commit ba8acd09e4
6 changed files with 187 additions and 39 deletions

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="AdventureWorks.MAUI.ViewsPartial.HeaderView">
<Grid RowDefinitions="Auto,Auto,Auto">
<Label Grid.Row="0"
Text="{Binding ViewTitle}"
HorizontalOptions="Center"
FontSize="Title" />
<Label Grid.Row="1"
Grid.ColumnSpan="2"
Text="{Binding ViewDescription}"
HorizontalOptions="Center"
FontSize="Body" />
<BoxView Grid.Row="2"
Grid.ColumnSpan="2"
Margin="0,0,0,20"
HeightRequest="1"
Color="Black" />
</Grid>
</ContentView>

View File

@ -0,0 +1,30 @@
namespace AdventureWorks.MAUI.ViewsPartial;
public partial class HeaderView : ContentView
{
public HeaderView()
{
InitializeComponent();
ViewTitle = "View Title";
ViewDescription = "View Description";
this.BindingContext = this;
}
public string ViewTitle
{
get { return (string)GetValue(ViewTitleProperty); }
set { SetValue(ViewTitleProperty, value); }
}
public string ViewDescription
{
get { return (string)GetValue(ViewDescriptionProperty); }
set { SetValue(ViewDescriptionProperty, value); }
}
public static readonly BindableProperty ViewTitleProperty =
BindableProperty.Create(nameof(ViewTitle), typeof(string), typeof(HeaderView), string.Empty);
public static readonly BindableProperty ViewDescriptionProperty =
BindableProperty.Create(nameof(ViewDescription), typeof(string), typeof(HeaderView), default(string));
}