Say if my users selects Mon,Tue,Wed how do i get that comma sep list of choices from the code behind in c#
I ideally a want to use the
<syncfusion:SfChipGroup ChildAdded="daySelection_ChildAdded" ChipClicked="daySelection_ChipClicked" SelectionChanged="daySelection_SelectionChanged" x:Name="daySelection" Type="Filter" SelectionIndicatorColor="Black" SelectedChipTextColor="Blue" ChipBackgroundColor="Black" ChipTextColor="White" Visual="Material">
<syncfusion:SfChipGroup.Items>
<syncfusion:SfChip Text="Sun"/>
<syncfusion:SfChip Text="Mon"/>
<syncfusion:SfChip Text="Tue"/>
<syncfusion:SfChip Text="Wed"/>
<syncfusion:SfChip Text="Thu"/>
<syncfusion:SfChip Text="Fri"/>
</syncfusion:SfChipGroup.Items>
</syncfusion:SfChipGroup>
private void daySelection_SelectionChanged(object sender, Syncfusion.Buttons.XForms.SfChip.SelectionChangedEventArgs e)
{
}
But am finding it hard to understand how to loop through the items
|
private void daySelection_SelectionChanged(object sender, Syncfusion.Buttons.XForms.SfChip.SelectionChangedEventArgs e)
{
var selectedItems = (sender as SfChipGroup).SelectedItems;
if(selectedItems != null)
{
if (selectedItems.Count == 0)
label.Text = "";
for (int i = 0; i < selectedItems.Count; i++)
{
if (i == 0)
{
label.Text = (selectedItems[i] as SfChip).Text;
}
else
label.Text += "," + (selectedItems[i] as SfChip).Text;
}
}
} |
Thats the magic sauce i was missing
(sender as SfChipGroup).SelectedItems;