0

I'm trying to get cities from sql and want to show them in combo box but it is getting all the values even they are repeated more than once. But i only want the distinct values. is it poassible to do this without IValueConverted function. This is what i tried. Here is the code.

<ComboBox x:Name="acity" Width="250" Margin="0,20,0,0" SelectedValuePath="AId" SelectedValue="{Binding AId}"  DisplayMemberPath="ACity" BorderBrush="Red" materialDesign:HintAssist.Hint="Select City" FontSize="14" ToolTip="Select City"/>

And in Cs file:

acity.ItemsSource = mt.Agents.Distinct().ToList();
Kirk Woll
  • 73,473
  • 21
  • 178
  • 189

0 Answers0