Okay I believe I figured out my first question (yes it was really that simple) but now I am stuck on replacing the hard-coded data with data retrieved from a WCF service. Almost everything works great...BUT the only thing that doesn't work for some reason is the SelectedItemsText seems to stop working. The drop-down populates correctly and the checkboxes work great (including the "All") checkbox, but when I switch to loading the items from a service the text is no longer appearing on the combo box. Here is my code:
Private
Sub
initCombo()
'create the source of the checkedCombo
'Dim cs As New ComboBoxSource()
''Hard coded select All Item
'cs.Add(New MyDataItem("All", "All", True))
''Add other Items you want
'cs.Add(New MyDataItem("001", "001", True))
'cs.Add(New MyDataItem("002", "002", True))
'cs.Add(New MyDataItem("003", "003", True))
'cs.Add(New MyDataItem("004", "004", True))
''DataBinding
'radCombo1.ItemsSource = cs
Dim
lSelectedGroup
As
String
=
CType
(RadComboBoxGroups.SelectedValue, GroupData).GroupNumber
Dim
lGroupService
As
New
GroupService.GroupDashboardServiceClient
AddHandler
lGroupService.GetDivisionsForGroupForDashboardCompleted,
AddressOf
GetDivisionsForGroupForDashboardCallback
lGroupService.GetDivisionsForGroupForDashboardAsync(lSelectedGroup,
True
)
End
Sub
Private
Sub
GetDivisionsForGroupForDashboardCallback(
ByVal
sender
As
Object
,
ByVal
e
As
GroupService.GetDivisionsForGroupForDashboardCompletedEventArgs)
If
DesignerProperties.IsInDesignTool
Then
Return
End
If
Dim
lRecords
As
List(Of Dictionary(Of
String
,
String
)) = e.Result
'create the source of the checkedCombo
Dim
cs
As
New
ComboBoxSource
For
Each
lRecord
As
Dictionary(Of
String
,
String
)
In
lRecords
cs.Add(
New
MyDataItem(lRecord(
"Division"
).ToString.Trim, lRecord(
"Division"
).ToString.Trim,
True
))
Next
'DataBinding
radCombo1.ItemsSource = cs
End
Sub
I don't understand why it would matter that I am pulling the data from a service when it comes to populating the SelectedItemsText. The really strange thing is that it begins working correctly once I click off to the right of one of the combobox items (to the right of the text where it doesn't check/uncheck the checkbox but just closes the drop-down). Once that happens, everything works correctly but I need it to work on initial load and without the user having to do this (like it does in your example).
Anyone have any ideas on what is causing this?
Thanks!!