Skip to content

Commit 1b39cd9

Browse files
authored
Added FontFamily property (#16)
* update * update
1 parent fb1c94a commit 1b39cd9

File tree

5 files changed

+19
-6
lines changed

5 files changed

+19
-6
lines changed

Demo/MauiProgram.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public static MauiApp CreateMauiApp()
1414
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
1515
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
1616
fonts.AddFont("fa-solid-900.ttf", "FASolid900");
17+
fonts.AddFont("Sevillana-Regular.ttf", "SevillanaRegular");
1718
})
1819
.UseStateButton();
1920

Demo/Pages/BasePage.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
</Grid>
5555
<breadcrumb:Breadcrumb BreadcrumbBackgroundColor="{DynamicResource BreadcrumBackground}"
5656
CornerRadius="6"
57+
FontFamily="SevillanaRegular"
5758
FontSize="Small"
5859
LastBreadcrumbBackgroundColor="{DynamicResource BreadcrumBackground}"
5960
LastBreadcrumbCornerRadius="6"
150 KB
Binary file not shown.

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,14 @@ Next up, just add the breadcrumb control onto that page and you're all set.
5454
|---|---|---- |
5555
| Separator | Sets the image source of the separator | This allows you to set the separator to `FontImageSource`, `UriImageSource` or `FileImageSource`. </br> Default is **new FontImageSource { Glyph = " / ", Color = Colors.Black, Size = 15, }** |
5656
| SeparatorHeight | Sets the height of the separator | Default is **15** |
57-
| FirstBreadcrumb | Allows you to override the first breadcrumb and set an image source. F.e. This is usefull if you want the first breadcrumb to be a home icon instead of the default title. | Default will be a label like all the other breadcrumbs |
58-
| ScrollBarVisibility | Sets the HorizontalScrollBarVisibility of the scrollview | More info here [ScrollBarVisibility](https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.scrollbarvisibility?view=xamarin-forms). Default value is **ScrollBarVisibility.Never** |
57+
| FirstBreadcrumb | Allows you to override the first breadcrumb and set an image source. F.e. This is useful if you want the first breadcrumb to be a home icon instead of the default title. | Default will be a label like all the other breadcrumbs |
58+
| ScrollBarVisibility | Sets the HorizontalScrollBarVisibility of the ScrollView | More info here [ScrollBarVisibility](https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.scrollbarvisibility?view=xamarin-forms). Default value is **ScrollBarVisibility.Never** |
5959
| FontSize | Sets the text font size for the breadcrumb | Default value is **15**. <br>Support [`NamedSize`](https://docs.microsoft.com/en-us/dotnet/api/xamarin.forms.namedsize?view=xamarin-forms) |
60-
| TextColor | Sets the text color for the breadcrumb and seperator | A `Color` object. <br> Default value is **black**. <br>*(doesnt include the last breadcrumb)* |
61-
| CornerRadius | A `CornerRadius` object representing each individual corner's radius for each breadcrumb. | Uses the `CornerRadius` struct allowing you to specify individual corners. <br> Default value is **10**. <br> *(doesnt include the last breadcrumb)* |
60+
| TextColor | Sets the text color for the breadcrumb and separator | A `Color` object. <br> Default value is **black**. <br>*(doesn't include the last breadcrumb)* |
61+
| FontFamily | Sets the font for the breadcrumb text | Defaults to default label font |
62+
| CornerRadius | A `CornerRadius` object representing each individual corner's radius for each breadcrumb. | Uses the `CornerRadius` struct allowing you to specify individual corners. <br> Default value is **10**. <br> *(doesn't include the last breadcrumb)* |
6263
| BreadcrumbMargin | A `Thickness` object used to define the spacing between the breadcrumb and separators | Uses the `Thickness` struct allowing you to specify left, top, right and bottom margin |
63-
| BreadcrumbBackgroundColor | This is the background color for the individual breadcrumbs | A `Color` object. <br> Default value is **Transparent**. <br> *(doesnt include the last breadcrumb)* |
64+
| BreadcrumbBackgroundColor | This is the background color for the individual breadcrumbs | A `Color` object. <br> Default value is **Transparent**. <br> *(doesn't include the last breadcrumb)* |
6465
| LastBreadcrumbTextColor | Sets the text color for the last breadcrumb | A Color object. <br> Default value is **black**. |
6566
| LastBreadcrumbCornerRadius | A `CornerRadius` object representing each individual corner's radius.| Uses the `CornerRadius` struct allowing you to specify individual corners. <br> Default value is **10**. |
6667
| LastBreadcrumbBackgroundColor | Sets the background color of the last breadcrumbs | A Color object. <br> Default value is **Transparent**. |

Scr/Breadcrumb.xaml.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,15 @@ public Color TextColor
6363
set => SetValue(TextColorProperty, value);
6464
}
6565

66+
// Font family
67+
public static readonly BindableProperty FontFamilyProperty = BindableProperty.Create(nameof(FontFamily), typeof(string), typeof(Breadcrumb), null, BindingMode.OneTime);
68+
public string FontFamily
69+
{
70+
get => (string)GetValue(FontFamilyProperty);
71+
set => SetValue(FontFamilyProperty, value);
72+
}
73+
74+
6675
// Corner radius
6776
public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create(nameof(CornerRadius), typeof(float), typeof(Breadcrumb), 10f, BindingMode.OneTime);
6877

@@ -243,7 +252,8 @@ Border BreadcrumbCreator(Page page, bool isLast, bool isFirst)
243252
Label breadcrumbText = new()
244253
{
245254
Text = page.Title,
246-
FontSize = FontSize
255+
FontSize = FontSize,
256+
FontFamily = FontFamily
247257
};
248258
breadcrumbText.SetBinding(Label.TextColorProperty, new Binding(isLast ? nameof(LastBreadcrumbTextColor) : nameof(TextColor), source: new RelativeBindingSource(RelativeBindingSourceMode.FindAncestor, typeof(Breadcrumb))));
249259
AutomationProperties.SetIsInAccessibleTree(breadcrumbText, false);

0 commit comments

Comments
 (0)