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. Image for the cookie policy date

How to hide GalleryItem dynamically

How can to hide a single GalleryItem dynamically on form load and show on a button click?


4 Replies

AS ashimaz March 15, 2009 05:13 AM UTC

Hope this is the correct way!

foreach (GalleryItem fgg in myMenuGroup.Items)
{
if (fgg.Name == "myGalleryExit")
{
myMenuGroup.Items.Remove(fgg);
myMenuGroup.UpdateLayout();
break;
}
}



PP Prabhu P Syncfusion Team March 16, 2009 10:45 AM UTC

Hi,

Thank you for your interest in Syncfusion products.

The following code will help you to hide the last item from the gallery.

int itemCount = this.galleryGroup.Items.Count;
if( itemCount > 0)
{
(this.galleryGroup.Items[--itemCount] as GalleryItem).Visibility = Visibility.Collapsed;
}

I have also created a simple sample to demonstrate how to add gallery item dynamically on Form load and hide/show item on button click event. Please navigate to the following link and see the sample.

http://files.syncfusion.com/support/Tools.WPF/7.1.0.30/80119/main.htm

Please feel free to contact us if you face any issues. We are very glad to assist you.

Thanks,
Prabu




AS ashimaz March 16, 2009 06:42 PM UTC

Thanks for your help.

The following code allows hiding an item at specific location (index).

(this.galleryGroup.Items.GetItemAt(2) as GalleryItem).Visibility = Visibility.Collapsed;





PP Prabhu P Syncfusion Team March 17, 2009 06:47 AM UTC

Hi,

Yes. That code will help us to hide an item at specific location based on the specified index. Hope you got an idea about how to play with Syncfusion Gallery control.

Please let us know if any other concerns.

Thank you for your interest in Syncfusion products.

Regards,
Prabu

>Thanks for your help.

The following code allows hiding an item at specific location (index).

(this.galleryGroup.Items.GetItemAt(2) as GalleryItem).Visibility = Visibility.Collapsed;






Loader.
Live Chat Icon For mobile
Up arrow icon