我正在使用Telerik
控件工作於WPF
應用程序,MVVM
模式。我正在使用telerik:RadListBox
集合綁定。我的問題是,當一個集合綁定到一個RadListBox時,集合將變成RadListBox
或RadListBoxItem
?RadListBox vs RadListBoxItem DragDrop WPF
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
我在拖拉'RadListBox'或'RadListBoxItem'嗎? – iamCR
檢查此,http://stackoverflow.com/questions/3350187/wpf-c-rearrange-items-in-listbox-via-drag-and-drop – iamCR
@SanthoshKumar我現在看到什麼讓你困惑。查看更新後的答案。 –