Hi there,
I implemented a drag and drop behavior within a radgridview based on this page: https://docs.telerik.com/devtools/wpf/controls/dragdropmanager/how-to/howto-draganddrop-within-radgridview and it works correctly.
But now I need to introduce grouping of elements based on a specific property
<telerik:RadGridView.GroupDescriptors>
<telerik:GroupDescriptor Member="GroupingField" SortDirection="Ascending" />
</telerik:RadGridView.GroupDescriptors>
I was able to modify the RadGridViewRowDragDropBehavior class so that dragging is limited to the current group, but when it is allowed, the dragged element falls to the last position in the group instead of the desired position. For example:
Group A
Item 1
Item 2
Group B
Item 3
Item 4
Item 5
Item 6
Group C
Item 7
when I drag “item 3” and drop it after “item 4” the result is as follows:
Group B
Item 4
Item 5
Item 6
Item 3
I tied to solve the problem by invoking the RadGridView.Rebind() method at the end of RadGridViewRowDragDropBehavior.OnDrop, but it does not work and I don't think this is the best solution, any suggestions?
Thanks
I've been dealing with an issue for awhile now where dragging and dropping multiple tree items is kind of difficult. If I select several items and then try to drag them somewhere else, it only works if I start the drag with my mouse over the last item selected. If I try to start the drag with my mouse over any other selected items then the tree selection changed event fires and wipes out all of the selected items except for the one I'm currently over.
Holding the shift key during all of this also makes it work as expected. But both of the ways that work aren't very obvious to users. Is there any other way to keep all of the selected items when dragging regardless of what item the drag starts over?
I would like to drag text outside of a WPF RadRichTextBox into a different App.
It seems that dragging any text just outside of this control is not possible, not even within the same app.
IMHO the problem is, that text can be moved within this control, and this feature cannot be deactivated.
Thanks a lot in advance for any hints.
Edit: Just checked with standard RichTextBox (FlowControl) no problems out of the box. I can drag text internal and as soon as mousepointer went outside, everything is fine and works there. Try this with RadRichTextBox and the Prompt goes crazy inside of your control.
Hey,
I am using a DragDropManager to drag images from a itemscontrol onto a table.
Now I want to rotate the image, if the user presses the Key "R" during Dragging.
But I dont get it to work.
All Input Bindings on the Window and DataTemplate did not fire.
Does anyone have an idea to achieve what I want?
DragDropManager.AddDragInitializeHandler(icImages, OnDragInitialize);
private void OnDragInitialize(object sender, DragInitializeEventArgs e)
{
clsImage imageData = (clsImage)((FrameworkElement)e.OriginalSource).DataContext;
DragDropData dragData = new DragDropData
{
ImageData = imageData ,
Column = Column
};
e.Data = dragData;
e.DragVisual = new ContentControl { ContentTemplate = LayoutRoot.Resources["ImageTemplate"] as DataTemplate, Content = imageData };
e.AllowedEffects = DragDropEffects.All;
e.Handled = true;
}
<DataTemplate x:Key="ImageTemplate">
<Grid>
<telerik:RadSvgImage
UriSource="{Binding file}"
HorizontalAlignment="Left"
SizeType="ContentToSizeStretch"
OverrideColor="{Binding ImageColor}"
/>
</Grid>
</DataTemplate>
Hi,
How can I detect if an appoint is moved?
Which event is being fired and how can I implement this in the ViewModel and View?
Thanks...
Hi,
I wanted to know if it is contemplated the possibility of drag and drop from a component such as the RadListBox for example to a RadGridView which has as RowDataTemplate another RadGridView. But, only allow to drag the activity of the RadListBox to the child RadGridView. How could I achieve that?
Thanks in advance.
<Window x:Class="ComponentesTestWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ComponentesTestWPF"
mc:Ignorable="d"
Title="MainWindow">
<Window.Resources>
<!--Child grid (activities template)-->
<DataTemplate x:Key="ChildTemplate">
<Grid MaxWidth="800" HorizontalAlignment="Left" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<telerik:RadButton Grid.Column="1" Width="25" Height="25" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5,0,0,0"
Command="{Binding DataContext.Commands[DeleteCommand],RelativeSource={RelativeSource AncestorType=UserControl}}"
CommandParameter="{Binding }" ToolTipService.ToolTip="Delete">
<TextBlock Text="Delete"/>
</telerik:RadButton>
<telerik:RadGridView x:Name="ActiviesRadGridView"
Grid.Column="0" IsBusy="{Binding IsBusy}" ActionOnLostFocus="None" CanUserFreezeColumns="False"
SelectionMode="Single" MaxHeight="200" MinHeight="150" AutoGenerateColumns="False"
ItemsSource="{Binding Activities, Mode=TwoWay}"
SelectedItem="{Binding SelectedActivity, RelativeSource={RelativeSource AncestorType=UserControl}, Mode=TwoWay}"
FrozenColumnsSplitterVisibility="Collapsed" CanUserDeleteRows="True" NewRowPosition="None">
<telerik:RadGridView.RowStyle>
<Style TargetType="telerik:GridViewRow">
<Setter Property="telerik:DragDropManager.AllowDrag" Value="True" />
</Style>
</telerik:RadGridView.RowStyle>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding DescActivity}" Width="*" TextWrapping="Wrap" IsReadOnly="True"/>
</telerik:RadGridView.Columns>
<telerik:RadGridView.Resources >
<Style TargetType="telerik:GridViewRow" >
<Setter Property="AllowDrop" Value="True"/>
<Setter Property="telerik:DragDropManager.AllowDrag" Value="True"/>
<Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="True"/>
</Style>
</telerik:RadGridView.Resources>
</telerik:RadGridView>
</Grid>
</DataTemplate>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!--Main grid (groups)-->
<telerik:RadGridView x:Name="GroupsGridView" Grid.Column="0"
SelectionMode="Extended" Margin="0,5,5,0" ActionOnLostFocus="None" CanUserFreezeColumns="False"
ItemsSource="{Binding Group, Mode=TwoWay}"
SelectedItem="{Binding SelectedGroup, Mode=TwoWay}"
RowDetailsTemplate="{StaticResource ChildTemplate}" IsBusy="{Binding IsBusy}">
<telerik:RadGridView.Columns>
<telerik:GridViewToggleRowDetailsColumn ExpandMode="Multiple"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Description}" Width="*" TextWrapping="Wrap" IsReadOnly="True"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Quantity}" Width="Auto" TextWrapping="Wrap" IsReadOnly="True"/>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Info}" Width="Auto" TextWrapping="Wrap" IsReadOnly="True"/>
</telerik:RadGridView.Columns>
<telerik:RadGridView.Resources >
<Style TargetType="telerik:GridViewRow" >
<Setter Property="AllowDrop" Value="False"/>
<Setter Property="telerik:DragDropManager.AllowDrag" Value="False"/>
<Setter Property="telerik:DragDropManager.AllowCapturedDrag" Value="False"/>
</Style>
</telerik:RadGridView.Resources>
</telerik:RadGridView>
<!--ListBox (activities)-->
<telerik:RadListBox x:Name="ActivitiesListBox" Grid.Column="1" Width="200" ItemsSource="{Binding ActivitiesList}" />
</Grid>
</Window>
Hello,
I have a floating RadPane, I need to identify when the user stops dragging it. It can be still floating and and not docked.