or

| <telerik:RadComboBox x:Name="InsurancePositionComboBox" IsEnabled="{Binding DataContext.IsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" |
| Grid.Row="4" Grid.Column="6" |
| ItemsSource="{Binding DataContext.InsurancePositionItems,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" |
| DisplayMemberPath="Name" |
| SelectedValuePath="StakeholderId" |
| SelectedValue="{Binding InsurancePositionId}" |
| IsSynchronizedWithCurrentItem="True" Margin="10,0,0,0" Height="25" Width="170"> |
| </telerik:RadComboBox> |
| <Window.Resources> |
| <Style x:Key="ItemContStyle" TargetType="{x:Type ListViewItem}"> |
| <Style.Resources> |
| <LinearGradientBrush x:Key="Brush1" StartPoint="0.5,0" EndPoint="0.5,1"> |
| <GradientStop Offset="0.1" Color="#AA00CC00" /> |
| <GradientStop Offset="0.8" Color="#55008800" /> |
| </LinearGradientBrush> |
| <LinearGradientBrush x:Key="Brush2" StartPoint="0.5,0" EndPoint="0.5,1"> |
| <GradientStop Offset="0.1" Color="Orange" /> |
| <GradientStop Offset="0.8" Color="OrangeRed" /> |
| </LinearGradientBrush> |
| </Style.Resources> |
| <Style.Triggers> |
| <DataTrigger Binding="{Binding Path=Category}" Value="1"> |
| <Setter Property="Background" Value="{StaticResource Brush1}" /> |
| <Setter Property="Height" Value="25"/> |
| </DataTrigger> |
| <DataTrigger Binding="{Binding Path=Category}" Value="2"> |
| <Setter Property="Background" Value="{StaticResource Brush2}" /> |
| <Setter Property="Height" Value="30"/> |
| </DataTrigger> |
| </Style.Triggers> |
| </Style> |
| </Window.Resources> |
| <ListView x:Name="listView1" ItemContainerStyle="{StaticResource ItemContStyle}"> |
| <ListView.View> |
| <GridView> |
| <GridViewColumn Header="Artist" DisplayMemberBinding="{Binding Path=Artist}" Width="310" /> |
| <GridViewColumn Header="Title" DisplayMemberBinding="{Binding Path=Title}" Width="310" /> |
| </GridView> |
| </ListView.View> |
| </ListView> |
selected_id = (
string)((DataRow)((DataRecord)this.radGridView_A1.SelectedRecord).Data)[0];
DataRecord is gone, any sugguestions, Also, don't understrand why telerik posts examples (as of 3 months ago ) of apis that will be obscolete, wtf?
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" /> |