This is a migrated thread and some comments may be shown as answers.

Drag and Drop problem with TileView

6 Answers 284 Views
TileView
This is a migrated thread and some comments may be shown as answers.
parag patel
Top achievements
Rank 1
parag patel asked on 22 Oct 2009, 10:10 AM
Hi,

I am trying to make user control in wpf where I have to drag and drop a item from RadPanelBar to RadTileView and vise versa. 
I am using telerik RadDragandDropManager class for drag and drop
i have set allowDrag and allowDrop property radpanelbar ,radpanelaritem, radtileview,radtileviewitem.

I am able to drag an item from tileview to panelbar It is working fine.

But when I drag an item for panelbar to tile view I get a null reference exception. This exception comes from radtileview control code file.

Now form my analysis I came to know that radtileview does not allow  to drag any item on it through RadDragandDropManager.

If you can provide me any example for this

6 Answers, 1 is accepted

Sort by
0
Tihomir Petkov
Telerik team
answered on 22 Oct 2009, 11:22 AM
Hi Parag,

There is a known bug in the Beta version of RadTileView which affects drag and drop scenarios. The issue will be resolved in the upcoming Q3 release which is due in the beginning of November.

Greetings,
Tihomir Petkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
dimiter
Top achievements
Rank 1
answered on 14 Dec 2009, 02:43 PM
Hi

I want to drag and drop Item in Tile view but drop events doesn't raise could you send me an example how to drop in Tile view 
Thanks in advance

greeting
0
Kiril Stanoev
Telerik team
answered on 17 Dec 2009, 02:07 PM
Hello Dimiter,

Please find attached a sample project that demonstrates drag&drop functionality between a list box and a tile view. Let me know if you find something unclear.


Greetings,
Kiril Stanoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Aleksey
Top achievements
Rank 1
answered on 21 Apr 2014, 11:36 AM
Hello, I have a problem with the cancell operation DragAndDrop in my RadTileView control. I Have some RadTileViewItem, which have the property AllowDrop=false, but i can still drop my RadTileViewItem on them.
Example: 
<telerik:RadTileView Grid.Row="1" ItemsSource="{Binding CommonAssets}" Style="{StaticResource HiddenTitleGrayStyle}" BorderBrush="Transparent" 
                             MinimizedColumnWidth="480" MinimizedRowHeight="325" RowHeight="325" ColumnsCount="3" MaximizeMode="Zero" 
                             ContentTemplate="{StaticResource MeasureItem}" HeaderStyle="{StaticResource GrayTileViewItemStarStyle}" ItemContainerStyle="{StaticResource ReordableItemStyle}">
            <telerik:RadTileView.Resources>
                <DataTemplate DataType="{x:Type pMe:ProtectiveMeasuresAssetVM}"/>
            </telerik:RadTileView.Resources>
            <i:Interaction.Behaviors>
                <behaviors:RadTilesDragDropBehavior/>
            </i:Interaction.Behaviors>
        </telerik:RadTileView>
In RadTilesDragDropBehavior.cs:

 protected override void OnAttached()
        {
            base.OnAttached();
            DragDropManager.AddDragInitializeHandler(AssociatedObject, OnDragInitialize);
         }
private void OnDragInitialize(object sender, DragInitializeEventArgs args)
        {
            var tileView = sender as RadTileView;
            draggingTile = args.OriginalSource as RadTileViewItem;
            foreach (var item in tileView.ChildrenOfType<RadTileViewItem>())
            {
                if (((ProtectiveMeasuresAssetVM)item.DataContext).IsTop != ((ProtectiveMeasuresAssetVM)draggingTile.DataContext).IsTop)
                    item.AllowDrop = false;
                else
                    item.AllowDrop = true;
            }
        }


After that, i can still DragAndDrop all items in my RadTileView 
Please, help me.


0
Martin Ivanov
Telerik team
answered on 22 Apr 2014, 11:27 AM
Hello Parag,

Note that when you set the AllowDrop property on a RadTileViewItem this will prevent the drop only if an element is dropped inside the item. In this case the dragged item is dropped on the RadTileView itself and this is why the AllowDrop property doesn't work.

In order to prevent the drop on a particular item you can handle the PreviewTilePositionChanged event of the RadTileView.
<telerik:RadTileView PreviewTilePositionChanged="RadTileView_PreviewTilePositionChanged" />
..................
private void RadTileView_PreviewTilePositionChanged(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
    RadTileView tileView = (RadTileView)sender;
    var container = e.OriginalSource as RadTileViewItem;
    if (container != null)
    {
        var item = tileView.ItemContainerGenerator.ItemFromContainer(container) as DataItem;
        if (item == null || !item.AllowDrop)
            e.Handled = true;
    }
}

You can also take a look at the Pinned Tiles demo. Note that this link leads to our Silverlight demos which share code with the WPF ones. If you prefer you can download the demos for WPF and find this demo there.

In addition I prepared a sample project which demonstrates this approach. Please give it a try and let me know if it helps.

Regards,
Martin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Aleksey
Top achievements
Rank 1
answered on 22 Apr 2014, 02:26 PM
Thank you so much. you helped me a lot.=)
Tags
TileView
Asked by
parag patel
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
dimiter
Top achievements
Rank 1
Kiril Stanoev
Telerik team
Aleksey
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or