Add Images to Gallery

Add-in Express™ Support Service
That's what is more important than anything else

Add Images to Gallery
 
Noufal C P




Posts: 53
Joined: 2010-01-27
Hello.. I have added Images(Dynamic adxRibbonbutton) to a adxRibbongallery at OnRibbonLoad .then i trying to add images after load ,it cannot refresh the ribbongallery.. it remain the same after adding images.. How can i add more images to ribbongallery through code? pls help me..
Posted 10 Mar, 2011 06:25:29 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Noufal,

Please try to use the PropertyChanging event handler of the AddinExpress.MSO.ADXRibbonButton or AddinExpress.MSO.ADXRibbonGallery class:

private void adxRibbonButton1_PropertyChanging(object sender, AddinExpress.MSO.ADXRibbonPropertyChangingEventArgs e)
{
   if (e.PropertyType == AddinExpress.MSO.ADXRibbonControlPropertyType.Glyph)
   {
       // do something here
       // e.Value = yourNewImage;
   }
}


Does it work for you?
.NET, Extended MAPI, Windows Phone & RT
Posted 10 Mar, 2011 06:36:14 Top
Noufal C P




Posts: 53
Joined: 2010-01-27
Thanx... I have designed an adxRibbongallery on ribbontab , and dynamically create and add button to the ribbongallery and set images through an imagelist..

Code:
foreach (string sFiles in allFiles)
{
imglistGalleryPic.Images.Add(System.Drawing.Image.FromFile(sFiles));
AddinExpress.MSO.ADXRibbonButton btnDynamicCommon = new AddinExpress.MSO.ADXRibbonButton();
btnDynamicCommon.Image = CountImg;
btnDynamicCommon.Description = sFiles;
btnDynamicCommon.ImageList = this.imglistGalleryPic;
adxRibbonGalleryFavorites.Items.Add(btnDynamicCommon);
CountImg++;
}

Here, sfile is the image which is loading from a directory, imglistGalleryPic is an imagelist,CountImg is counter to set image to button from imagelist ..

I have used this function in AddinloadEvent it added all the images in gallery and working good, after this, i have added images to the directory and reload the same function with out closing application.. but, its not loaded the new images.. I have used your code, but its same..you please help me by giving solution soon..
Posted 11 Mar, 2011 00:34:43 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Noufal,

Did you try to debug? The following code works like a charm on my PC with Windows 7 x64 SP1 and Office 2010 x64:

private void adxRibbonButton1_OnClick(object sender, AddinExpress.MSO.IRibbonControl control, bool pressed)
{
    imageList1.Images.Add(System.Drawing.Image.FromFile(@"G:	est.png"));            
    AddinExpress.MSO.ADXRibbonItem btnDynamicCommon = new AddinExpress.MSO.ADXRibbonItem();                        
    btnDynamicCommon.ImageList = this.imageList1;
    btnDynamicCommon.Image = 0;
    btnDynamicCommon.Caption = "My Test Item";
    adxRibbonGallery1.Items.Add(btnDynamicCommon);
}
.NET, Extended MAPI, Windows Phone & RT
Posted 11 Mar, 2011 08:26:07 Top
Noufal C P




Posts: 53
Joined: 2010-01-27
thnx.. its working well...
Posted 14 Mar, 2011 04:01:44 Top