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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set a Icon to a GroupBarItem via C#

Thread ID:

Created:

Updated:

Platform:

Replies:

127033 Oct 22,2016 08:47 AM UTC Oct 24,2016 05:49 AM UTC WPF 1
loading
Tags: GroupBar
Christian Vogt
Asked On October 22, 2016 08:47 AM UTC

Hello,

I try to setup the Icoon of a groupbariten via C# but I am not succedding. The same icon is working in XAML however not in C#.

C# is not working:
GroupBarItem taskBarItem=new GroupBarItem();
BitmapImage image = new BitmapImage();
            
image.BeginInit();
image.UriSource = new Uri("/Icons/offers.png");
image.EndInit();

taskBarItem.HeaderImageSource = image;
taskBar.Items.Add(taskBarItem);

XAML is working:
            <syncfusion:GroupBarItem HeaderText="Test" Name="test"
                    ShowInGroupBar="True" HeaderImageSource="/Icons/offers.png" >
            </syncfusion:GroupBarItem>

Sugapriya Mariappan [Syncfusion]
Replied On October 24, 2016 05:49 AM UTC

Hi Christian,

Thank you for contacting Syncfusin Support.

We have prepared a sample based on the code example which you have provided. In this sample,you need to define the path of the format to display the icon.

Please download the sample from the below link

Sample: http://www.syncfusion.com/downloads/support/forum/127033/ze/GroupBarItemIconWPFSample1692118573.zip 

Also check the code snippet and screenshot from the below

Code Snippet:


GroupBarItem taskBarItem = new GroupBarItem() { HeaderText = "Test" };
BitmapImage image = new BitmapImage();

image.BeginInit();
image.UriSource = new Uri("/Icons/offers.png", UriKind.Relative);
image.EndInit();

taskBarItem.HeaderImageSource = image;
taskBar.Items.Add(taskBarItem);


Screenshot:




Could you please check the above solution and let us know if it is helpful?

Regards,
M.Sugapriya

 


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

or the page will be automatically redirected to 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

;