---
title: "Ribbon Button Image Programtically"  
description: "Ribbon Button Image Programtically"  
author: "Anonymous User"  
published: 2013-12-23  
updated: 2013-12-23  
canonical: https://www.mindstick.com/forum/1820/ribbon-button-image-programtically  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Ribbon Button Image Programtically

I'm [trying](https://answers.mindstick.com/qa/93698/6-mistakes-couples-are-trying-to-save-money) to load a [image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) onto a [Ribbon](https://www.mindstick.com/interview/1494/what-is-ribbon-in-sharepoint-2010) [Button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net). This is the System.Windows.Controls.RibbonBar type.

## here is the code:

```
public RibbonGroup CreateButtons(){    RibbonGroup GroupControlComputers = new RibbonGroup();    GroupControlComputers.Header = "Computer Control";    GroupControlComputers.Items.Add(DropdownButton("DropDown Stuffs"));    return GroupControlComputers;    }public RibbonButton DropdownButton(String Caption){    RibbonButton NewRibbonButton = new RibbonButton();    NewRibbonButton.Label = Caption;    NewRibbonButton.AllowDrop = true;    return NewRibbonButton;}
```

I cant [figure](https://yourviews.mindstick.com/view/87536/what-are-ghosts-jobs-and-how-to-figure-out-them) out how to add a [icon](https://www.mindstick.com/articles/13090/icon-the-identity-of-your-brand). i can add the button without an image with no problems

Path to [class file](https://www.mindstick.com/forum/60/how-we-add-dll-with-other-class-file) creating button is MyProject\[Functions](https://www.mindstick.com/forum/160140/explain-the-role-of-functions-as-a-service-faas-in-serverless-computing)\Ribbonbar.cs

Path to the Icon File is MyProject\[Images](https://www.mindstick.com/interview/1067/what-is-the-php-predefined-variable-that-tells-the-what-type-of-images-that-php-support)\Test\smallicon.ico

I have tried to figure out the LargeImageSource and just cant understand what I need to do.

Any help would be appreciated

## Replies

### Reply by Pravesh Singh

Hi Ashish,

There are two images which you need to specify:

LargeImageSource and SmallImageSource, they actually need to be different (one - larger and one - smaller), but for test try this:

```
public RibbonButton DropdownButton(String Caption){    RibbonButton NewRibbonButton = new RibbonButton();    NewRibbonButton.Label = Caption;    BitmapImage image = new BitmapImage();    image.BeginInit();    // your path to image might be different    image.UriSource = new Uri("pack://application:,,,/Images/Test/smallicon.ico");    image.EndInit();    NewRibbonButton.SmallImageSource = image;    NewRibbonButton.LargeImageSource = image;    NewRibbonButton.AllowDrop = true;    return NewRibbonButton;}
```


---

Original Source: https://www.mindstick.com/forum/1820/ribbon-button-image-programtically

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
