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


Guest


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


Guest


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?
Posted 10 Mar, 2011 06:36:14 Top
Noufal C P


Guest


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


Guest


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);
}
Posted 11 Mar, 2011 08:26:07 Top
Noufal C P


Guest


thnx.. its working well...
Posted 14 Mar, 2011 04:01:44 Top