We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting OpenIcon & CloseIcon from Code Behind to a non image file

Thread ID:

Created:

Updated:

Platform:

Replies:

146363 Aug 1,2019 11:45 AM UTC Aug 6,2019 10:12 AM UTC Xamarin.Forms 1
loading
Tags: SfBackdropPage
Matthew Bailey
Asked On August 1, 2019 11:45 AM UTC

Hello,

I'm wondering if the CloseIcon and OpenIcon can be bound to a unicode value somehow in the code behind?

I'm converting my app to incorporate Syncfusion, and I have a page using BackdropPage, but I'd like to customize the icons without forcing a local or embedded image. I have other places in my app where I declare an image based on the glyph unicode from a font I loaded. I do that with FontImageSource within the Image.Source reference in XAML
<Image>
    <Image.Source>
         <FontImageSource/>
    </Image.Source>
</Image>

Can I manipulate these resources in SfBackdropPage in a similar way?

Rachel A [Syncfusion]
Replied On August 6, 2019 10:12 AM UTC

 
 
You can place the FontImageSource in the place of Open and Close icon of the SfBackdrop page. We have achieved this requirement using the toolbar item clicked event. Please find the below code snippet and sample for your reference. 
 
[C#] 
 
public MainPage()
{
            InitializeComponent();

            ToolbarItems[0].Clicked += Handle_Clicked;
}

void Handle_Clicked(object sender, EventArgs e)
{
            FontImageSource fontImageSource = new FontImageSource();

            fontImageSource.FontFamily = Device.RuntimePlatform == Device.Android ? "UIFontIcons.ttf#UIFontIcons" : Device.RuntimePlatform == Device.iOS ? "UIFontIcons" : "Assets/UIFontIcons.ttf#UIFontIcons";
            fontImageSource.Color = Color.Red;

            if (((sender as ToolbarItem).Parent as SfBackdropPage).IsBackLayerRevealed)
            {
                fontImageSource.Glyph = "\ue72d";
            }
            else
            {
                fontImageSource.Glyph = "\ue709";
            }

            (sender as ToolbarItem).IconImageSource = fontImageSource;
}
 
 
Please follow the below procedure to add font file for each platform. 
 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Rachel. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon