【发布时间】:2016-07-04 19:53:44
【问题描述】:
我正在使用 Telerik 控件开发具有 MVVM 模式的 WPF 应用程序。
我正在使用绑定集合的telerik:RadListBox。我的问题是,当集合绑定到 RadListBox 时,集合将变为 RadListBox 或 RadListBoxItem ?
XAML:
<telerik:RadListBox x:Name="lstMarketSeries" ItemsSource="{Binding MarketSeriesCollection, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True, ValidatesOnDataErrors=True}" ItemContainerStyle="{StaticResource DraggableListBoxItem}"DragLeave="lstMarketSeries_DragLeave" Style="{StaticResource myListboxStyle}" SelectionMode="Extended" telerik:StyleManager.Theme="Windows8">
</telerik:RadListBox>
XAML.cs:
/// <summary>
/// Event fired when series are dragged and moved.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void lstMarketSeries_DragLeave(object sender, DragEventArgs e)
{
if (sender is RadListBox) // True
{
}
if(sender is RadListBoxItem) //False Why??
{
}
}
当一个集合被绑定时,它应该作为项目返回正确吗?为什么我将它作为RadListBox 本身而不是RadListBoxItem 得到它?
现在我需要那个 Draggable 对象作为RadListBoxItem。有什么办法吗?
仅供参考,
请看这里ListBoxDragDrop 发件人是ListBoxItem 而不是ListBox
【问题讨论】: