In my Xamarin XAML I use this many times:
<Label Text="{x:Static local:FontAwesome.FACheck}" FontFamily="FontAwesome"
XAlign="Center" FontSize="13"
TextColor="#1E90FF" />
Is there a way using C# that I can create a custom version of Label and use that so I don't have to keep specifying the Font and other things?
Go to Mailings > Labels. In the Address box, type the text that you want. To change the formatting, select the text, right-click, and make changes with Home > Font or Paragraph. In the Label Options dialog box, make your choices, and then select OK.
Logolab is the most convenient logo design APP, easily and fast create stunning logos & icons for your business with just a few taps, even if you have no design experience.
Canva’s drag-and-drop tool allows you to create a professional-quality label with no graphic design experience needed. With hundreds of designer-made templates, we have taken the guesswork out of spacing, formatting and font pairing—so you can focus on growing your business.
If you use the Labels feature in Word, you may want to specify which label to use as the starting point when printing. ... When you create a document designed to be printed on a particular type of label stock, it might be helpful if Word ...
Alternatively, click inside the cell, select the Table Tools Layout tab at the top of the page, click on Select, and choose Select Cell. Copy your label using the Copy menu in your software or using a keyboard shortcut (Windows: Ctrl + C / MacOS: ⌘ + C). Next, you need to select the labels into which you will add your copied design.
A label should include: 1 the product name 2 the company logo or icon 3 production details such as a list of ingredients 4 a short description of the product and a product story if applicable 5 design elements such as typographic pairing and white space.
Maybe, you can use a Style
in your App.xaml.
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="YourAPp.App">
<Application.Resources>
<ResourceDictionary>
<Style x:Key="FACheck" TargetType="Label">
<Setter Property="Text" Value="{x:Static local:FontAwesome.FACheck}"/>
<Setter Property="FontFamily" Value="FontAwesome"/>
<Setter Property="XAlign" Value="Center"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="TextColor" Value="#1E90FF"/>
</Style>
<ResourceDictionary>
</Application.Resources>
</Application>
And then in your pages, you just need to use it wherever you need to place this label.
<Label Style="{StaticResource FACheck}"/>
In case you want to define your resources in C#
public class App : Application
{
public App ()
{
//Begin - Style code
var faCheckStyle = new Style(typeof(Label))
{
Setters = {
new Setter { Property = Label.TextProperty, Value = FontAwesome.FAChcek },
new Setter { Property = Label.FontFamilyProperty, Value = "FontAwesome" },
new Setter { Property = Label.XAlignProperty, Value = "FontAwesome" },
new Setter { Property = Label.FontSizeProperty, Value = 13 },
new Setter { Property = Label.TextColorProperty, Value = Color.FromHex("#1E90FF") }
}
};
Resources = new ResourceDictionary();
Resources.Add("FACheck", faCheckStyle);
//End Style code
}
...
}
Create your class and use it everywhere
public class MyAwesomeLabel : Xamarin.Forms.Label
{
public MyAwesomeLabel()
{
FontFamily = "FontAwesome";
XAlign = Xamarin.Forms.TextAlignment.Center; //deprecated BTW
FontSize = 13;
TextColor = Color.FromHex(0x1E90FF);
//etc
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With