or
if (this.radGridView_A1.SelectedRecords.Count() == 0)
does not compile with the latest (q3) wpf dlls
| ObservableCollection<Song> _mediaLib; |
| ObservableCollection<Song> _playlist; |
| private void InitGrids() |
| { |
| _mediaLib = new ObservableCollection<Song>(); |
| _playlist = new ObservableCollection<Song>(); |
| radGridViewMediaLib.ItemsSource = _mediaLib; |
| radGridViewPlaylist.ItemsSource = _playlist; |
| RadDragAndDropManager.AddDropQueryHandler(radGridViewMediaLib, OnDropQuery); |
| RadDragAndDropManager.AddDropQueryHandler(radGridViewPlaylist, OnDropQuery); |
| RadDragAndDropManager.AddDragQueryHandler(radGridViewMediaLib, OnOrderDragQuery); |
| RadDragAndDropManager.AddDragQueryHandler(radGridViewPlaylist, OnOrderDragQuery); |
| RadDragAndDropManager.AddDragInfoHandler(radGridViewMediaLib, OnOrderDragInfo); |
| RadDragAndDropManager.AddDragInfoHandler(radGridViewPlaylist, OnOrderDragInfo); |
| } |
| #region DragDrop |
| private void OnDropQuery(object sender, DragDropQueryEventArgs e) |
| { |
| // We allow drop only if the dragged items are products: |
| ICollection draggedItems = e.Options.Payload as ICollection; |
| bool result = draggedItems.Cast<object>().All((object item) => item is Song); |
| e.QueryResult = result; |
| e.Handled = true; |
| // Note that here we agree to accept a drop. We will be notified |
| // in the DropInfo event whether a drop is actually possible. |
| } |
| private void OnOrderDragQuery(object sender, DragDropQueryEventArgs e) |
| { |
| RadGridView gridView = sender as RadGridView; |
| if (gridView != null) |
| { |
| IList selectedItems = gridView.SelectedItems.ToList(); |
| e.QueryResult = selectedItems.Count > 0; |
| e.Options.Payload = selectedItems; |
| } |
| e.QueryResult = true; |
| e.Handled = true; |
| } |
| private void OnOrderDragInfo(object sender, DragDropEventArgs e) |
| { |
| RadGridView gridView = sender as RadGridView; |
| IEnumerable draggedItems = e.Options.Payload as IEnumerable; |
| if (e.Options.Status == DragStatus.DragInProgress) |
| { |
| //Set up a drag cue: |
| TreeViewDragCue cue = new TreeViewDragCue(); |
| //Here we need to choose a template for the items: |
| cue.ItemTemplate = this.Resources["Song"] as DataTemplate; |
| cue.ItemsSource = draggedItems; |
| e.Options.DragCue = cue; |
| } |
| else if (e.Options.Status == DragStatus.DragComplete) |
| { |
| IList source = gridView.ItemsSource as IList; |
| foreach (object draggedItem in draggedItems) |
| { |
| _playlist.Add((Song)draggedItem); |
| } |
| } |
| } |
| #endregion |
| private ObservableCollection<Song> GetSongs(int count) |
| { |
| ObservableCollection<Song> _sList = new ObservableCollection<Song>(); |
| for (int i = 0; i < count; i++) |
| { |
| Song _s = new Song(); |
| _s.Artist = "Artist " + i.ToString(); |
| _s.Title = "Title " + i.ToString(); |
| _s.GUID = Guid.NewGuid(); |
| _sList.Add(_s); |
| } |
| return _sList; |
| } |
| //Song class |
| public class Song |
| { |
| public Song() |
| { |
| } |
| public Guid GUID { get; set; } |
| public string Artist { get; set; } |
| public string Title { get; set; } |
| } |
| <Window.Resources> |
| <Style TargetType="gridViewElements:GridViewRow" x:Key="OrderItemStyle"> |
| <Setter Property="dragDrop:RadDragAndDropManager.AllowDrag" Value="True" /> |
| </Style> |
| <LinearGradientBrush x:Key="DropPossibleBackground" StartPoint="0 0" EndPoint="0 1"> |
| <GradientStop Offset="0" Color="White" /> |
| <GradientStop Offset="1" Color="#FFE699" /> |
| </LinearGradientBrush> |
| </Window.Resources> |
| <telerik:RadGridView Height="762" Margin="12,42,571,-42" Name="radGridViewMediaLib" Width="595" HorizontalAlignment="Left" |
| IsReadOnly="True" dragDrop:RadDragAndDropManager.AllowDrop="True" |
| RowStyle="{StaticResource OrderItemStyle}" Background="White" |
| CanUserFreezeColumns="False" CanUserInsertRows="False" |
| ShowGroupPanel="False" /> |
| <telerik:RadGridView Height="762" Margin="0,50,64,-50" Name="radGridViewPlaylist" Width="480" HorizontalAlignment="Right" |
| IsReadOnly="True" dragDrop:RadDragAndDropManager.AllowDrop="True" |
| RowStyle="{StaticResource OrderItemStyle}" Background="White" |
| CanUserFreezeColumns="False" CanUserInsertRows="False" |
| ShowGroupPanel="False" /> |
| this.radGrid1.ItemsSource = dtData; |
| <telerikGrid:RadGridView |
| x:Name="radGrid1" |
| MultipleSelect="True" |
| AutoGenerateColumns="False" |
| ShowColumnFooters="True" ShowGroupFooters="True"> |
| <telerikGrid:RadGridView.Columns> |
| <telerikGrid:GridViewDataColumn Header="AccountNo" DataMemberBinding="{Binding AccountNo}"> |
| <telerikGrid:GridViewDataColumn.AggregateFunctions> |
| <telerikData:CountFunction Caption="Count:" /> |
| </telerikGrid:GridViewDataColumn.AggregateFunctions> |
| </telerikGrid:GridViewDataColumn> |
| <telerikGrid:GridViewDataColumn Header="InvestmentCost" DataMemberBinding="{Binding InvestmentCost}" DataFormatString="{}{0:c}" TextAlignment="Right"> |
| <telerikGrid:GridViewDataColumn.AggregateFunctions> |
| <telerikData:SumFunction ResultFormatString="{}{0:c}" SourceField="InvestmentCost" /> |
| <telerikData:MinFunction ResultFormatString="{}{0:c}" SourceField="InvestmentCost" /> |
| <telerikData:MaxFunction ResultFormatString="{}{0:c}" SourceField="InvestmentCost" /> |
| </telerikGrid:GridViewDataColumn.AggregateFunctions> |
| </telerikGrid:GridViewDataColumn> |
| </telerikGrid:RadGridView.Columns> |
| </telerikGrid:RadGridView> |
| <Trigger Property="IsLoadingOnDemand" Value="True"> |
| <Trigger.EnterActions> |
| <BeginStoryboard> |
| <Storyboard> |
| <DoubleAnimation Duration="00:00:01" RepeatBehavior="Forever" Storyboard.TargetName="LoadingVisualAngleTransform" Storyboard.TargetProperty="Angle" From="0" To="359"/> |
| </Storyboard> |
| </BeginStoryboard> |
| </Trigger.EnterActions> |
| <Setter Property="Visibility" TargetName="LoadingVisual" Value="Visible"/> |
| <Setter Property="Visibility" TargetName="Expander" Value="Collapsed"/> |
| </Trigger> |
| <Trigger Property="IsLoadingOnDemand" Value="True"> |
| <Trigger.EnterActions> |
| <BeginStoryboard> |
| <Storyboard x:Name="NodeLoadingStoryboard"> |
| <DoubleAnimation Duration="00:00:01" RepeatBehavior="Forever" Storyboard.TargetName="LoadingVisualAngleTransform" Storyboard.TargetProperty="Angle" From="0" To="359"/> |
| </Storyboard> |
| </BeginStoryboard> |
| </Trigger.EnterActions> |
| <Trigger.ExitActions> |
| <StopStoryboard BeginStoryboardName="NodeLoadingStoryboard" /> |
| </Trigger.ExitActions> |
| <Setter Property="Visibility" TargetName="LoadingVisual" Value="Visible"/> |
| <Setter Property="Visibility" TargetName="Expander" Value="Collapsed"/> |
| </Trigger> |