Telerik Forums
UI for WPF Forum
1 answer
26 views

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

 

 

 

Carlo
Top achievements
Rank 1
Iron
 answered on 14 Jan 2025
0 answers
51 views

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?

 

Blaine
Top achievements
Rank 1
 asked on 02 Jan 2025
0 answers
44 views

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.

 

 




Marcus
Top achievements
Rank 2
 updated question on 06 Dec 2024
1 answer
57 views
Is it possible to get the mouse coordinates while in a handler for this event? It seems like Mouse.GetPosition isn't returning valid information.
Martin Ivanov
Telerik team
 answered on 02 Dec 2024
1 answer
44 views

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>
Stenly
Telerik team
 answered on 09 Oct 2024
1 answer
39 views
When dragging over a timeslot in RadScheduleView. The Drag over visual showing the start and end times are always shown in 12h Format. Even though my PC locale is set to 24h format.


When dragging over the 15:00 slot, It shows 3PM and 5PM instead of 15:00 and 17:00. The timeruler correctly shows the same format as my PC locale but the drag over visual seems to always be 12h.

Stenly
Telerik team
 answered on 02 Oct 2024
1 answer
53 views

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...

Martin Ivanov
Telerik team
 answered on 13 Sep 2024
1 answer
77 views

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>


Stenly
Telerik team
 answered on 10 Jun 2024
0 answers
54 views
Is the TableShape solution from the Demos application available for download? I've tried using the SDK samples browser and looking in Github repo. I can't find it. Also, does it support Drag and Drop?
Will
Top achievements
Rank 1
Iron
 asked on 23 May 2024
1 answer
64 views

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.

Stenly
Telerik team
 answered on 08 Apr 2024
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?