Comments (9)
I am setting the Icon using FontImageSource and it works just fine.
Followed this article by @jamesmontemagno to add the Font Icons to my project.
<flex:FlexButton.Icon> <FontImageSource Glyph="" FontFamily="{StaticResource MaterialFontFamily}"/> </flex:FlexButton.Icon>
from flexbutton.
this should be a dream!
from flexbutton.
I try for this... can I?
from flexbutton.
Yeah, please feel free do. Would love to see a PR on this. I was looking at font-awesome. Ping me here if you need any help or code explanations!
from flexbutton.
do you think is it possible to use https://github.com/jsmarcus/Iconize
from flexbutton.
It would be possible to leverage Jeremy's work for sure. But I want to keep the dependencies of this library as few as possible. So I would prefer to implement it as shown here: https://forums.xamarin.com/discussion/31530/fontawesome-label-heres-how
from flexbutton.
@robinmanuelthiel is it now possible to use Icon Fonts?
from flexbutton.
If you want to display only the icon with Iconize this behavior should work:
public class FlexButtonFontIcon
{
public static readonly BindableProperty IconProperty =
BindableProperty.Create(
@"Icon",
typeof(string),
typeof(FlexButtonFontIcon),
default(string),
propertyChanged: IconPropertyChanged);
public static void SetIcon(BindableObject view, string value)
{
view.SetValue(IconProperty, value);
}
public static string GetIcon(BindableObject view)
{
return (string)view.GetValue(IconProperty);
}
private static void IconPropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
{
var iconKey = newvalue as string;
if (!(bindable is FlexButton view) || string.IsNullOrWhiteSpace(iconKey))
return;
var icon = Iconize.FindIconForKey(iconKey);
if (icon != null)
{
var iconModule = Iconize.FindModuleOf(icon);
view.FontFamily = $"{iconModule.FontPath}#{iconModule.FontName}";
view.Text = $"{icon.Character}";
}
}
}
Then just add on button:
<flex:FlexButton local:FlexButtonFontIcon.Icon="icon-name" FontSize="26"/>
from flexbutton.
WoW
from flexbutton.
Related Issues (20)
- Image stays dark after pressed HOT 3
- Setting Icon throwing System.NullReferenceException: Object reference not set to an instance of an object. HOT 2
- NullReferenceException when using global Style HOT 3
- Support Multiple parameters for CornerRadius
- Please update to Xamarin.Forms 4
- Not working on Xamarin.Forms 4.0.0 HOT 2
- Icon Crashing on Xamarin.Forms 4.0.0 HOT 6
- not fire ClickedCommand or TouchedUpCommand HOT 2
- FlexButton won't work on iOS when using it on Xamarin Forms Project HOT 4
- A few suggestions HOT 4
- 【bug】focus status changed when clicked the flexbutton HOT 2
- IconOrientation.Top don't work in button from NuGet HOT 2
- [Android] TouchedDownCommand NullReferenceException HOT 1
- Buttons don't center in Grid HOT 1
- Feature request: Property to change icon size
- SVG Icon's doesn't work
- CornerRadius not working in Xamarin.iOS current versions (somewhat workaround inside) HOT 2
- Click event is called repeatedly when using flexbutton inside a TitleView HOT 1
- AndroidX Support HOT 1
- Rounded Corners on IOS not working HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flexbutton.