Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Elegant Ribbon Tech Support » Gallery Collapse All
Subject Author Date
esraa khedr Sep 27, 2009 - 7:45 AM

Dear


i am trying to use Gallery.SelectedItemChanged event, but the selectedItem property doesn’t differentiate between the different selected items


Can you help me to use this property properly ?!!


Regards,


Esraa


 

Technical Support Sep 30, 2009 - 12:43 PM

The output you are getting is completely correct. The fact is that in both cases you receive a reference to the object of the class GalleryItem that exposes all the properties for each gallery item. It is naturally for class objects that WriteLine method produces the object type name string. You can cast the e.OldValue or StyleGallery.SelectedItem to the type GalleryItem to access the item properties. You can also call StyleGallery.Items.IndexOf(e.OldValue) or StyleGallery.Items.IndexOf(StyleGallery.SelectedItem) in order to get the correspondent item index.

esraa khedr Sep 30, 2009 - 12:54 AM

Thanks very much for reply, but unfortunately it did not work with me. I have tried the following code


private void StyleGallery_SelectedItemChanged(object sender, GallerySelectedItemChangedEventArgs e)

        {

            Console.WriteLine(">>"+StyleGallery.SelectedItem);

            Console.WriteLine(">>>"+e.OldValue);

        }


and the result was "Elegant.Ui.GalleryItem" for each time i select a new item which is unexpected, i’ve expected to find an index of the selected item or any other unique identifier


Waiting for reply, Thanks


 

Technical Support Sep 28, 2009 - 4:53 AM

We have just checked this. The SelectedItem property changes each time when you select a new item in the gallery. When you handle the Gallery.SelectedItemChanged event, you can get an old value from in the EventArgs. The new value is in the SelectedItem.

void gallery1_SelectedItemChanged(object sender, GallerySelectedItemChangedEventArgs e)
        {
            //gallery1.SelectedItem;
            //e.OldValue;
        }
So this should work. If not, please elaborate so send a test app to our support mail box.


esraa khedr Sep 30, 2009 - 12:54 AM

Thanks very much for reply, but unfortunately it did not work with me. I have tried the following code


 


private void StyleGallery_SelectedItemChanged(object sender, GallerySelectedItemChangedEventArgs e)



        {



            Console.WriteLine(">>"+StyleGallery.SelectedItem);



            Console.WriteLine(">>>"+e.OldValue);



        }


 


and the result was "Elegant.Ui.GalleryItem" for each time i select a new item which is unexpected, i’ve expected to find an index of the selected item or any other unique identifier


 


Waiting for reply, Thanks