Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

New Post: Custom Binding for MultiSelectComboBox

$
0
0
Setup
VS 2010
WPF 4.0
CM 1.3.1

I am using the MultiSelectComboBox found at the link below. It's a ComboBox that includes a checkbox for each Item and allows multiple selections. Items Source and selected items are of type Dictionary(Of String, Object).

http://www.codeproject.com/Articles/563862/Multi-Select-ComboBox-in-WPF?msg=4744582#xx4744582xx

My attempt to set up custom binding in the bootstrapper looks like this:
            ConventionManager.AddElementConvention(Of LPCore.Controls.MultiSelectComboBox) _
                (LPCore.Controls.MultiSelectComboBox.SelectedItemsProperty, "Text", "ValueChanged").GetBindableProperty = Function(foundControl As DependencyObject)
                                                                                                                              Dim element = DirectCast(foundControl, MultiSelectComboBox)

                                                                                                                              Dim useViewModel = element.ContentTemplate Is Nothing

                                                                                                                              If useViewModel Then
                                                                                                                                  Return View.ModelProperty
                                                                                                                              End If

                                                                                                                              Return LPCore.Controls.MultiSelectComboBox.SelectedItemsProperty
                                                                                                                          End Function
I strongly suspect that my custom binding is wrong, but I need help to correct it. At run time I get "Cannot find view for... in the UI, instead of the control.

Thanks, CM is great!

Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>