Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for font icon and using FAB Menu in the TitleView #1

Open
npagare opened this issue Nov 27, 2018 · 2 comments
Open

Support for font icon and using FAB Menu in the TitleView #1

npagare opened this issue Nov 27, 2018 · 2 comments

Comments

@npagare
Copy link

npagare commented Nov 27, 2018

Hi @PolarBearOC , what a wonderful code ! There is so much to learn from your work here.

What changes I need to do to support font icon instead of images? I am using fontawesome and materialicon sets.

I was looking for a FAB that I could attach in my TitleView on the rightmost end and provide a dropdown menu experience. Each menu item to have an image and corresponding text no the left.

My goal is to show the image ( font icon preferred) of the active menu, starting with a default selection. Is this something I could do via setting bindable properties in MainPage.xaml ? Or do I need to change the code behind the FloatingMenu.cs ?

Your help will be appreciated.

Thanks

@Polarts
Copy link
Owner

Polarts commented Nov 27, 2018

Hi @IoTFier , glad to see you're trying to use my solution!

Lately I couldn't get the time to update it with better features, but I have plans to do and what you suggested is a major part of the features I'll be adding.

The icon is basically the only XAML element inside FloatingButton.xaml so to change it to text all you need to do it make it a label with your desired font size.

(FloatingButton.xaml line 11)
<Label x:Name="Icon" FontSize="35"/> <!-- was Image. change the value of FontSize to whatever fits for you. -->

Since the IconSrc property is a string, you can bind it to the unicode pointing to the icon you'd like to display, then make this change in OnPropertyChanged:

(FloatingButton.xaml.cs lines 80-83)
else if (propertyName == IconSrcProperty.PropertyName) { Icon.Text= IconSrc; //was Icon.Source }

That's all for the icon font implementation.

I may have misunderstood you for this part, so please correct me if I'm wrong.
For changing the icon according to your active menu, simply bind the IconSrc property to a string property that would change each time the user enters a menu. Don't forget to raise the OnPropertyChanged event for the rendering engine to update your view.

@npagare
Copy link
Author

npagare commented Nov 28, 2018

HI @PolarBearOC , thank you for your response. I will write a detailed input in next couple of hours.
My apology for delayed input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants