Xamarin.Forms Different View Per Platform and Device - xamarin.forms

I have a project in Xamarin.Forms, and i'm trying to create 4 views: Android phone, Android tablet, iPhone and iPad. I've tried a little example, something like this in the XAML:
<ContentPage.Content>
<ContentView>
<OnPlatform x:TypeArguments="View">
<On Platform="iOS">
<!-- Use view for iOS here -->
<OnIdiom x:TypeArguments="View">
<OnIdiom.Phone>
<Frame x:Name="MainFrameiPhone">
<StackLayout BackgroundColor="#FF00FF">
</StackLayout>
</Frame>
</OnIdiom.Phone>
<OnIdiom.Tablet>
<Frame x:Name="MainFrameiPad">
<StackLayout BackgroundColor="#00FF00">
</StackLayout>
</Frame>
</OnIdiom.Tablet>
</OnIdiom>
</On>
<!--Same for android -->
<On Platform="Android">
...
</On>
</OnPlatform>
</ContentView>
</ContentPage.Content>
But i don't want to rename each frame and component i use in the 4 views (For example MainFrameiPhone and MainFrameiPad).
I'm doing it right? or can i create 4 views and call each one from the code behind?
What's the better way to do this?
Thanks!

You could use ControlTemplate .
public class MainFrameiPhone: Frame
{
public TealTemplate ()
{
...
// set the content here
}
}
public class MainFrameiPad: Frame
{
...
}
in content page
ControlTemplate mainFrameiPhone= new ControlTemplate(typeof(MainFrameiPhone));
ControlTemplate mainFrameiPad= new ControlTemplate(typeof(MainFrameiPad));
//...
public MainPage()
{
//...
ContentView content = new ContentView() {
Content = {
//...
}
};
if(Device.RuntimePlatform=="iOS")
{
if(Device.Idiom==TargetIdiom.Phone)
{
content.ControlTemplate = mainFrameiPhone;
}
else if(Device.Idiom == TargetIdiom.Phone)
{
content.ControlTemplate = mainFrameiPad;
}
}
else if(Device.RuntimePlatform == "Android")
{
if (Device.Idiom == TargetIdiom.Phone)
{
content.ControlTemplate = xxx;
}
else if (Device.Idiom == TargetIdiom.Phone)
{
content.ControlTemplate = xxx;
}
}
else
{
content.ControlTemplate = xxx;
}
Content = content;
}

Related

Uno Main Layout

I am new to Uno and I have been following the frame navigation tutorial. I noticed that when the frame navigates the entire window changes. This is good but not optimal. Is there a way in Uno to have a Main Layout, like you would see in a ASP.Net MVC project? I would rather not implement the navigation menu on each page.
To extend on #matfillion's answer, if NavigationView doesn't suit your needs, you can easily roll your own navigation shell whilst leveraging the built-in frame navigation. There's no requirement for Frame to be the top-level control in your application.
Here's an ultra-simple example, to illustrate the principle. The navigation list will stay visible at the top whilst navigating between pages.
Shell.xaml:
<UserControl x:Class="UnoTestbed44.Shell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ListView x:Name="NavigationList"
Background="LightGray"
ItemsSource="{x:Bind Pages}"
Grid.Row="0"
DisplayMemberPath="Label"
SelectionChanged="NavigationList_SelectionChanged">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
<Frame x:Name="MainFrame"
Grid.Row="1" />
</Grid>
</UserControl>
Shell.xaml.cs:
using System;
using System.Linq;
using Windows.UI.Xaml.Controls;
namespace UnoTestbed44
{
public sealed partial class Shell : UserControl
{
public NavigationItem[] Pages { get; } = new[] {
new NavigationItem {Label = "First page", PageType = typeof(Page1)},
new NavigationItem {Label = "Second page", PageType = typeof(Page2)},
};
public Shell()
{
this.InitializeComponent();
}
private void NavigationList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (e.AddedItems.FirstOrDefault() is NavigationItem navigationItem)
{
MainFrame.Navigate(navigationItem.PageType);
}
}
public class NavigationItem
{
public string Label { get; set; }
public Type PageType { get; set; }
}
}
}
Override OnLaunched() in App.xaml.cs:
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if NET5_0 && WINDOWS
_window = new Window();
_window.Activate();
#else
_window = Windows.UI.Xaml.Window.Current;
#endif
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (_window.Content == null)
{
_window.Content = new Shell();
}
#if !(NET5_0 && WINDOWS)
if (e.PrelaunchActivated == false)
#endif
{
// Ensure the current window is active
_window.Activate();
}
}
While not exactly what you are looking for, I believe the NavigationView control is your closest bet. You can disable CompactView and obtain something like what is showcased in UnoGallery.

Carousel View in Xamarin forms not responding to Image button in the view

I cannot get the image buttons to move the carousel image to the next in the list. when I click the imagebutton and step through the code the Position is changing properly, but does not move the carousel in the view. Any help would be greatly appreciated. Here is the code for both my View and View Model:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Das_Local.Views.MainPage"
xmlns:vm="clr-namespace:Das_Local.ViewModels"
Title="{Binding Title}">
<ContentPage.BindingContext>
<vm:MainViewModel/>
</ContentPage.BindingContext>
<ContentPage.Resources>
<ResourceDictionary>
<Color x:Key="Accent">#96d1ff</Color>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout>
<StackLayout VerticalOptions="Start">
<CarouselView ItemsSource="{Binding Images}" HorizontalOptions="FillAndExpand" HeightRequest="375">
<CarouselView.ItemTemplate>
<DataTemplate>
<Image Source="{Binding ImageUrl}" Aspect="AspectFill" />
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
</StackLayout>
<StackLayout>
<Label Text="Whats New in the Local" FontSize="Title" HorizontalTextAlignment="Center" Margin="0,10,0,-10"/>
<Grid HorizontalOptions="FillAndExpand" VerticalOptions="CenterAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<CarouselView Grid.Row="1" HorizontalOptions="FillAndExpand" ItemsSource="{Binding Articles}">
<CarouselView.ItemTemplate>
<DataTemplate>
<Frame HasShadow="True">
<StackLayout Margin="0,0">
<Label Text="{Binding ArticleTitle}" FontAttributes="Bold" FontSize="Title"/>
<Label Text="{Binding ArticleTextBody}" FontSize="Body" />
</StackLayout>
</Frame>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
<ImageButton Grid.Row="1" Source="left.png" Aspect="Fill" HorizontalOptions="Start" VerticalOptions="Center" BackgroundColor="Transparent"
HeightRequest="35" WidthRequest="35" Command="{Binding ChangePositionCommand}" CommandParameter="L"/>
<ImageButton Grid.Row="1" Source="right.png" Aspect="Fill" HorizontalOptions="End" VerticalOptions="Center" BackgroundColor="Transparent"
HeightRequest="35" WidthRequest="35" Command="{Binding ChangePositionCommand}" CommandParameter="R"/>
</Grid>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>
--------------------------------------------------------------------------------------------------
using System.Collections.ObjectModel;
using System.Windows.Input;
using Das_Local.Models;
using Xamarin.Forms;
namespace Das_Local.ViewModels
{
class MainViewModel : BaseViewModel
{
public MainViewModel()
{
Title = "SMART 29";
images = GetCarouselImages();
articles = GetCarouselArticles();
ChangePositionCommand = new Command(ChangePosition);
}
private ObservableCollection<CarouselImages> images;
public ObservableCollection<CarouselImages> Images
{
get { return images; }
set
{
images = value;
OnPropertyChange();
}
}
private ObservableCollection<CarouselImages> GetCarouselImages()
{
return new ObservableCollection<CarouselImages>
{
new CarouselImages { ImageUrl= "anglewrappedduct.jpg" },
new CarouselImages { ImageUrl = "ductrun.jpg" },
new CarouselImages { ImageUrl = "offset.jpg" },
new CarouselImages { ImageUrl = "panels.jpg" }
};
}
ObservableCollection<CarouselArticles> articles;
public ObservableCollection<CarouselArticles> Articles
{
get { return articles; }
set
{
articles = value;
OnPropertyChange();
}
}
private ObservableCollection<CarouselArticles> GetCarouselArticles()
{
return new ObservableCollection<CarouselArticles>
{
new CarouselArticles { ArticleTitle= "This Title", ArticleTextBody = "Body of the article will go here"},
new CarouselArticles { ArticleTitle = "Another Title", ArticleTextBody = "Just what I need more text for the article body" },
new CarouselArticles { ArticleTitle = "My Third Title", ArticleTextBody = "I am getting burned out on writing random things"},
new CarouselArticles { ArticleTitle = "Bravo", ArticleTextBody = "whats the deal with these free channels"}
};
}
public ICommand ChangePositionCommand { get; set; }
private CarouselArticles selectedarticle;
public CarouselArticles SelectedArticle
{
get { return selectedarticle; }
set
{
selectedarticle = value;
OnPropertyChange();
}
}
private int position;
public int Position
{
get { return position; }
set
{
position = value;
selectedarticle = articles[position];
OnPropertyChange(nameof(SelectedArticle));
}
}
private void ChangePosition(object obj)
{
string direction = (string)obj;
if (direction == "L")
{
if (position == 0)
{
Position = articles.Count - 1;
return;
}
Position -= 1;
}
else if (direction == "R")
{
if (position == articles.Count - 1)
{
Position = 0;
return;
}
Position += 1;
}
}
}
}

How to drag and drop Items between two ListView Controls?

There are two listviews, one of them is grouped and other is not. I have to drag items from one list and drop into other. The drag and drop should be visual like item should actually be seen dragging and dropping on the UI. After some search, I found this tutorial TouchTrackingEffect Demos and thought to apply the same logic to Listview controls. I have somehow managed to apply the touch effects to the ListViews and it is firing events such as pressed, moved and released. I also managed to add items to the grouped listview. However, it is not showing dragging and dropping on the screen. I am assuming, I am doing something wrong but I am new to Xamarin so trying my best to get it working. The attached images show the UI, 2 shows the startup screen, 3 shows the X and Y coordinates in "Moved" effect, and 4 shows "New Word" is added in Grouped ListView on Released event. Below is the code, I would appreciate if someone can help me in this regard.
Page2Grid.Xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TouchTrackingEffect.Models;
using System.Collections.ObjectModel;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using TouchTracking;
using SkiaSharp;
using SkiaSharp.Views.Forms;
namespace TouchTrackingEffect
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class Page2Grid : ContentPage
{
//public ObservableCollection<GroupedStructureModel> grouped { get; set; }
ObservableCollection<GroupedStructureModel> grouped = new ObservableCollection<GroupedStructureModel>();
public ObservableCollection<GroupedStructureModel> grouped1 { get { return grouped; } }
// Drag and Drop Class
class DragInfo
{
public DragInfo(long id, Point pressPoint, AbsoluteLayout absoluteLayout)
{
Id = id;
PressPoint = pressPoint;
absoluteLayoutID = absoluteLayout;
}
public long Id { private set; get; }
public AbsoluteLayout absoluteLayoutID { set; get; }
public Point PressPoint { private set; get; }
}
// dictionary for ListViews
Dictionary<ListView, DragInfo> lstStructDragDictionary = new Dictionary<ListView, DragInfo>();
Dictionary<ListView, DragInfo> lstWordsDragDictionary = new Dictionary<ListView, DragInfo>();
Random random = new Random();
public Page2Grid()
{
InitializeComponent();
populateRhymeListView();
// adding effects to ListViews
// Main List
TouchEffect touchEffect1 = new TouchEffect();
touchEffect1.TouchAction += OnTouchEffectAction;
lstViewMain.Effects.Add(touchEffect1);
// Word List
TouchEffect touchEffect2 = new TouchEffect();
touchEffect2.TouchAction += OnTouchEffectAction;
lstViewWords.Effects.Add(touchEffect2);
}
void OnTouchEffectAction(object sender, TouchActionEventArgs args)
{
lstViewWords = sender as ListView;
switch (args.Type)
{
case TouchActionType.Pressed:
// don't allow a second touch on an already touched boxview
if (!lstWordsDragDictionary.ContainsKey(lstViewWords))
{
lstWordsDragDictionary.Add(lstViewWords, new DragInfo(args.Id, args.Location, absLayout));
// set capture property to true
TouchEffect toucheffect = (TouchEffect)lstViewWords.Effects.FirstOrDefault(e => e is TouchEffect);
toucheffect.Capture = true;
}
break;
case TouchActionType.Moved:
if (lstWordsDragDictionary.ContainsKey(lstViewWords) && lstWordsDragDictionary[lstViewWords].Id == args.Id)
{
//lstViewMain.TranslateTo
headerLbl.Text = " listWords is moved";
Rectangle rect = AbsoluteLayout.GetLayoutBounds(lstViewWords);
Point initialLocation = lstWordsDragDictionary[lstViewWords].PressPoint;
rect.X += args.Location.X - initialLocation.X;
rect.Y += args.Location.Y - initialLocation.Y;
AbsoluteLayout.SetLayoutBounds(lstViewWords, rect);
headerLbl.Text = "X = " + args.Location.X + " Y = " + args.Location.Y;
}
break;
case TouchActionType.Released:
if (lstWordsDragDictionary.ContainsKey(lstViewWords) && lstWordsDragDictionary[lstViewWords].Id == args.Id)
{
grouped1.FirstOrDefault().Add(new StructureModel { word = "New Word" });
}
break;
}
}
// Create a Grouped ListView from a Rhyme Description
void populateRhymeListView()
{
// defining two lines
GroupedStructureModel list1Group = new GroupedStructureModel() { LongName = "Line1" };
GroupedStructureModel list2Group = new GroupedStructureModel() { LongName = "Line2" };
// words for List 1
//List<WordList> wordLst1 = new List<WordList>();
list1Group.Add(new StructureModel { word = "first"});
// words for List
list2Group.Add(new StructureModel { word = "second1" });
grouped1.Add(list1Group);
grouped1.Add(list2Group);
// binding list itemsource
lstViewMain.ItemsSource = grouped1;
}
async void BtnNext_Clicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new Page3());
}
}
}
****Page2Grid.Xaml****
<?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:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="TouchTrackingEffect.Page2Grid">
<ContentPage.Content>
<AbsoluteLayout x:Name="absLayout">
<StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand">
<Grid x:Name="gridLayout">
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"></ColumnDefinition>
<ColumnDefinition Width="300"></ColumnDefinition>
<ColumnDefinition Width="300"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label x:Name="headerLbl" Text="Welcome to Xamarin.Forms!"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" />
<Button x:Name="btnNext" Grid.Row="0" Grid.Column="2" Text="Next" Clicked="BtnNext_Clicked"></Button>
<!--Main ListView containing structure -->
<ListView x:Name ="lstViewMain" Grid.Row="1" Grid.Column="0" IsGroupingEnabled="true" GroupDisplayBinding="{Binding LongName}" WidthRequest="200" BackgroundColor="Azure">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Label x:Name="lblItem" Text="{Binding word}"></Label>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<!--2nd Column-->
<BoxView x:Name="test" Grid.Row="1" Grid.Column="1"></BoxView>
<!-- Word List Views-->
<ListView x:Name="lstViewWords" Grid.Row="1" Grid.Column="2" BackgroundColor="AliceBlue">
<ListView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Baboon</x:String>
<x:String>Capuchin Monkey</x:String>
<x:String>Blue Monkey</x:String>
<x:String>Squirrel Monkey</x:String>
<x:String>Golden Lion Tamarin</x:String>
<x:String>Howler Monkey</x:String>
<x:String>Japanese Macaque</x:String>
</x:Array>
</ListView.ItemsSource>
</ListView>
</Grid>
</StackLayout>
</AbsoluteLayout>
</ContentPage.Content>
</ContentPage>

Xamarin Listview don't show the observable Collection

I'm using Xamarin.Forms MVVM to develop my app, and don't found what I'm doing wrong, I have an ObservableCollection with the values from web API, and when I set a break point all the values are good even in the view when I see the values of the binding source everything have the value, but the values are not showing up in my ListView.
Here is the ViewModel
class DatosMedicosViewModel : BaseViewModel
{
private ApiService apiService;
private ObservableCollection<Land> land;
private bool isRefreshing;
public ObservableCollection<Land> Lands
{
get { return this.land; }
set { SetValue(ref this.land, value); }
}
public bool IsRefreshing
{
get { return this.isRefreshing; }
set { SetValue(ref this.isRefreshing, value); }
}
public DatosMedicosViewModel()
{
this.apiService = new ApiService();
this.LoadLand();
}
private async void LoadLand()
{
this.IsRefreshing = true;
var connection = await this.apiService.CheckConnection();
if (!connection.IsSuccess)
{
this.IsRefreshing = false;
await Application.Current.MainPage.DisplayAlert(
"Error",
connection.Message,
"Accept");
await Application.Current.MainPage.Navigation.PopAsync();
return;
}
var response = await this.apiService.GetList<Land>(
"url Base",
"prefix",
"Controller");
if (!response.IsSuccess)
{
this.IsRefreshing = false;
await Application.Current.MainPage.DisplayAlert(
"Error",
response.Message,
"Accept"
);
return;
}
var list = (List<Land>)response.Result;
this.Lands = new ObservableCollection<Land>(list);
this.IsRefreshing = false;
}
public ICommand RefreshCommand
{
get
{
return new RelayCommand(LoadLand);
}
}
}
Here is the View
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ARLAPP.Views.ConsultaPage"
BackgroundColor="White"
BindingContext="{Binding Main, Source={StaticResource Locator}}"
Title="Lands">
<ContentPage.Content>
<StackLayout
BindingContext="{Binding Lands}"
Padding="5">
<StackLayout>
<Image
VerticalOptions="Center"
WidthRequest="300"
Source="UserIcon"
BackgroundColor="Transparent"/>
<Label Text="Mark"
VerticalOptions="Center"
HorizontalOptions="CenterAndExpand"
FontAttributes="Bold"
FontSize="Medium"/>
</StackLayout>
<StackLayout>
<ListView
SeparatorVisibility="Default"
FlowDirection="LeftToRight"
BackgroundColor="White"
ItemsSource="{Binding Lands}"
HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Label
Grid.Column="2"
VerticalOptions="Center"
TextColor="Black"
Text="{Binding Currency}"/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</StackLayout>
</ContentPage.Content>
</ContentPage>
Here how I call the view
if (this.PageName == "Lands")
{
MainViewModel.GetInstance().Lands= new LandViewModel();
Application.Current.MainPage = new LandMasterPage();
}
Check your BindingContext. I think you are setting it wrong in your view.
In your top-level StackLayout you set the the BindingContext to your property: BindingContext="{Binding Lands}". And in your ListView you set the ItemsSource also to this property: ItemsSource="{Binding Lands}". That won't work because the ListView is trying to bind to a property Lands inside your BindingContext, which is also set to Lands.
Remove the BindingContext from your top-level StackLayout, because you don't need it.
Ensure the BindingContext of your page ConsultaPage is set to your view-model DatosMedicosViewModel.
Sample of setting the bindingcontext (abstract code):
var mypage = new ConsultaPage();
mypage.BindingContext = new DatosMedicosViewModel();
await Navigation.PushAsync(mypage);
// Load your data in OnAppearing() of the page-event
This should solve your binding-problem.
Side-Note: As Abdul Gani said in the comments: Ensure you implement the INotifyPropertyChanged interface, but I assume you do this already in your BaseViewModel and call the NotifyChanged-Event in your SetValue-Method.

How to change font family of ListView items

I have a ListView and I'm using the standard "native" template and groups.
How do I set the font for the text in the group header and the item?
Here is an example for setting dynamic LayoutOptions in ListHeader, like wise you can pre-set these attributes for individual label and customize your header. now as what you want, you can set your own font family or colour or font size, or may be customize your header cell, It is just an ItemTemplate
<ListView x:Name="ListView" IsGroupingEnabled="true">
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<Label
HorizontalOptions="{Binding Optn}"
Text="{Binding Heading}"
VerticalOptions="{Binding Optn}" />
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Label Text="{Binding DisplayName}" />
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Happy Coding!
I've fixed the text and detail labels using this...
public class MyTextCellRenderer : TextCellRenderer
{
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
{
var cell = base.GetCell(item, reusableCell, tv);
if (cell.TextLabel.Font.FamilyName != CommonStyles.RegularFontName)
{
cell.TextLabel.Font = UIFont.FromName(
CommonStyles.RegularFontName, cell.TextLabel.Font.PointSize);
cell.DetailTextLabel.Font = UIFont.FromName(
CommonStyles.RegularFontName, cell.DetailTextLabel.Font.PointSize);
}
return cell;
}
}
For the section headers, this works initially...
UILabel.AppearanceWhenContainedIn(typeof(UITableView)).Font = ...
When the section header has been scrolled off screen and back on again, it reverts to the standard though.
But this works...
public class CustomTableViewRenderer : TableViewRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<TableView> e)
{
base.OnElementChanged(e);
if (e.NewElement != null)
{
Control.Source = new CustomTableViewModelRenderer(e.NewElement);
}
}
}
public class CustomTableViewModelRenderer : UnEvenTableViewModelRenderer
{
public CustomTableViewModelRenderer(TableView model) : base(model)
{
}
public override void WillDisplayHeaderView(UITableView tableView, UIView headerView, nint section)
{
if (headerView is UITableViewHeaderFooterView view)
{
view.TextLabel.Font = UIFont.FromName(CommonStyles.RegularFontName, 18);
}
}
}
That's a lot of code to change some fonts.

Resources