Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 5a6062f

Browse files
authoredAug 14, 2023
Fix tab view item font family (ios and uwp) (#1979)
1 parent 65b048e commit 5a6062f

File tree

7 files changed

+63
-1
lines changed

7 files changed

+63
-1
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<pages:BasePage xmlns="http://xamarin.com/schemas/2014/forms"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:pages="clr-namespace:Xamarin.CommunityToolkit.Sample.Pages"
5+
xmlns:vm="clr-namespace:Xamarin.CommunityToolkit.Sample.ViewModels.TestCases"
6+
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
7+
x:Class="Xamarin.CommunityToolkit.Sample.Pages.TestCases.Issue1978Page">
8+
<pages:BasePage.BindingContext>
9+
<vm:Issue1978ViewModel />
10+
</pages:BasePage.BindingContext>
11+
<ContentPage.Content>
12+
<xct:TabView>
13+
<xct:TabViewItem Text="&#xf09d;"
14+
TextColor="Green"
15+
FontSize="24" FontSizeSelected="28"
16+
FontFamily="FARegular"
17+
IsSelected="True">
18+
<Label Text="TabViewItem text should be an icon."
19+
HorizontalTextAlignment="Center" />
20+
</xct:TabViewItem>
21+
<xct:TabViewItem Text="&#xf09d;"
22+
TextColor="Black"
23+
FontSize="24" FontSizeSelected="28"
24+
FontFamily="FARegular">
25+
<Label Text="TabViewItem text should be an icon."
26+
HorizontalTextAlignment="Center" />
27+
</xct:TabViewItem>
28+
</xct:TabView>
29+
</ContentPage.Content>
30+
</pages:BasePage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Xamarin.Forms.Xaml;
2+
3+
namespace Xamarin.CommunityToolkit.Sample.Pages.TestCases
4+
{
5+
[XamlCompilation(XamlCompilationOptions.Compile)]
6+
public partial class Issue1978Page : BasePage
7+
{
8+
public Issue1978Page()
9+
{
10+
InitializeComponent();
11+
}
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Xamarin.CommunityToolkit.Sample.ViewModels.TestCases
2+
{
3+
public class Issue1978ViewModel : BaseViewModel
4+
{
5+
public Issue1978ViewModel()
6+
{
7+
}
8+
}
9+
}

‎samples/XCT.Sample/ViewModels/TestCases/TestCasesGalleryViewModel.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ protected override IEnumerable<SectionModel> CreateItems() => new[]
6363
new SectionModel(
6464
typeof(Issue1900Page),
6565
"BadgeView Issue GitHub #1900",
66-
"BadgeView default text")
66+
"BadgeView default text"),
67+
68+
new SectionModel(
69+
typeof(Issue1978Page),
70+
"TabView Issue GitHub #1978",
71+
"TabView font family")
6772
};
6873
}
6974
}

‎samples/XCT.Sample/Xamarin.CommunityToolkit.Sample.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
<EmbeddedResource Update="Pages\TestCases\Issue1900.xaml">
3333
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
3434
</EmbeddedResource>
35+
<EmbeddedResource Update="Pages\TestCases\Issue1978.xaml">
36+
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
37+
</EmbeddedResource>
3538
<EmbeddedResource Update="Pages\TestCases\Popups\PopupModalPage.xaml">
3639
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
3740
</EmbeddedResource>

‎src/CommunityToolkit/Xamarin.CommunityToolkit/Views/TabView/CupertinoTabViewItemTemplate.shared.cs

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ protected override void OnParentSet()
6969
text.SetBinding(Label.TextColorProperty, "CurrentTextColor");
7070
text.SetBinding(Label.FontSizeProperty, "CurrentFontSize");
7171
text.SetBinding(Label.FontAttributesProperty, "CurrentFontAttributes");
72+
text.SetBinding(Label.FontFamilyProperty, "CurrentFontFamily");
7273

7374
badge.SetBinding(TabBadgeView.BackgroundColorProperty, "CurrentBadgeBackgroundColor");
7475
badge.SetBinding(TabBadgeView.BorderColorProperty, "CurrentBadgeBorderColor");

‎src/CommunityToolkit/Xamarin.CommunityToolkit/Views/TabView/WindowsTabViewItemTemplate.shared.cs

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ protected override void OnParentSet()
6565
text.SetBinding(Label.TextColorProperty, "CurrentTextColor");
6666
text.SetBinding(Label.FontSizeProperty, "CurrentFontSize");
6767
text.SetBinding(Label.FontAttributesProperty, "CurrentFontAttributes");
68+
text.SetBinding(Label.FontFamilyProperty, "CurrentFontFamily");
6869

6970
badge.SetBinding(TabBadgeView.BackgroundColorProperty, "CurrentBadgeBackgroundColor");
7071
badge.SetBinding(TabBadgeView.TextProperty, "BadgeText");

0 commit comments

Comments
 (0)
This repository has been archived.