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

Ribbon MVVM (Gallery Binding)

Hello dear developers,
I have one question.

I have tried to bind to Gallery with MVMM but I couldn't do it.

At first I created DataTemplate for Syncfusion Gallery.
Here is it.

<DataTemplate DataType="{x:Type vm:GalleryViewModel}">
            <ContentControl>
                <sf:Gallery VisualMode="Standard">
                </sf:Gallery>
            </ContentControl>
 </DataTemplate>

After that I compiled my application and got empty RibbonGroup.
Ok. it is normal bacause I did not set ItemSource for Gallery.

I set ItemSourse to Gallery DataTemplate and got this:

<DataTemplate DataType="{x:Type vm:GalleryViewModel}">
            <ContentControl>
                <sf:Gallery VisualMode="Standard"
                            ItemsSource="{Binding Items}">
                </sf:Gallery>
            </ContentControl>
        </DataTemplate>

After build and run application I got a strange exception.

An unhandled exception of type 'System.InvalidCastException' occurred in Syncfusion.Tools.WPF.dll

Additional information: Unable to cast object of type 'TestGalleryBinding.ViewModels.GalleryCategoryViewModel' to type 'Syncfusion.Windows.Tools.Controls.GalleryGroup'.

Could you explain me how I should make DataTemplate for Gallery, GalleryGroup and GalleryItem?

I attached sample that describes this problem.

Yours faithfully,
Sergey Vlasov

Attachment: TestGalleryBinding_2fc288ff.zip

1 Reply

VR Vijayalakshmi Roopkumar Syncfusion Team March 23, 2015 04:41 PM UTC

Hi Sergey,

Sorry for the inconvenience caused,

We were able to reproduce the reported exception with the Gallery and we have logged a defect report regarding on this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let me know if you have any questions.

Regards,

Vijayalakshmi V.R.


Loader.
Live Chat Icon For mobile
Up arrow icon