first time set the ItemsSource then select one,the selecteditems's count is 1,
when reset the tilelist's ItemsSource,select one, the selecteditems count is 2,
<telerik:RadTileList HorizontalAlignment="Left" ItemsSource="{Binding FpFieldDisplays,Mode=TwoWay}" SelectionMode="Multiple" VerticalAlignment="Top" SelectionChanged="RadTileList_SelectionChanged"/>
<Button x:Name="button" Content="load" HorizontalAlignment="Left" Margin="385,271,0,0" VerticalAlignment="Top" Width="75" Click="button_Click"/>
<Button x:Name="button_Copy" Content="count" HorizontalAlignment="Left" Margin="385,171,0,0" VerticalAlignment="Top" Width="75" Click="button1_Click"/>
backend
/// </summary>
public partial class MainWindow : Window
{
private vm vv = new vm();
public MainWindow()
{
InitializeComponent();
this.DataContext = vv;
}
private int cunt = 0;
private void RadTileList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var tile = sender as Telerik.Windows.Controls.RadTileList;
cunt = tile.SelectedItems.Count;
}
private void button_Click(object sender, RoutedEventArgs e)
{
vv.FpFieldDisplays = new ObservableCollection<itm>()
{
new itm() {Name ="21",value = "1" },
new itm() {Name ="22",value = "2" },
new itm() {Name ="21",value = "1" },
new itm() {Name ="22",value = "2" },
new itm() {Name ="21",value = "1" },
new itm() {Name ="22",value = "2" },
new itm() {Name ="21",value = "1" },
new itm() {Name ="22",value = "2" },
new itm() {Name ="23",value = "3" }
};
}
private void button1_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show(cunt.ToString());
}
}
public class vm : BindableBase
{
public vm()
{
FpFieldDisplays = new ObservableCollection<itm>()
{
new itm() {Name ="1",value = "1" },
new itm() {Name ="2",value = "2" },
new itm() {Name ="3",value = "3" }
};
}
private ObservableCollection<itm> mFpFieldDisplays;
public ObservableCollection<itm> FpFieldDisplays
{
get { return this.mFpFieldDisplays; }
set { this.SetProperty(ref this.mFpFieldDisplays, value); }
}
}
public class itm
{
public string Name { get; set; }
public string value { get; set; }
}