Map dragging issue when inside a TileView

2 posts, 0 answers
  1. Tanguy Detroz
    Tanguy Detroz avatar
    17 posts
    Member since:
    Sep 2006

    Posted 05 Sep 2011 Link to this post

    Hello,

    we are upgrading our Telerik librairies from Q3 2010 to Q2 2011 and have noticed a problem we didn't have before.
    We have Map controls placed as content of TileViewItems. When placed inside a TileViewItem, dragging the Map with the mouse is not possible anymore (outside of TileViewItem, the dragging works perfectly).

    <telerik:RadTileView x:Name="TileView"
        <telerik:RadTileViewItem Header="Map"
            <telerik:RadMap
                <telerik:RadMap.Provider
                    <telerik:OpenStreetMapProvider /> 
                </telerik:RadMap.Provider
            </telerik:RadMap
        </telerik:RadTileViewItem
    </telerik:RadTileView>

    Searching the forum, we found this message: http://www.telerik.com/community/forums/silverlight/tileview/i-need-help.aspx#1766844

    public MainPage()
        {
            InitializeComponent();
            this.TileView.ItemContainerGenerator.StatusChanged += new EventHandler(ItemContainerGenerator_StatusChanged);
        }
      
    private void ItemContainerGenerator_StatusChanged(object sender, EventArgs e)
        {
            Telerik.Windows.Controls.ItemContainerGenerator containergenerator = sender as Telerik.Windows.Controls.ItemContainerGenerator;
            if (containergenerator != null && containergenerator.Status == Telerik.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated)
            {
                foreach (var item in TileView.Items)
                {
                    var container = containergenerator.ContainerFromItem(item);
                    if (container != null)
                        Telerik.Windows.DragDrop.DragDropManager.SetAllowDrag(container, false);
                }
            }
        }

    Using the StatusChanged event of the ItemContainerGenerator and SetAllowDrag on the container works fines for all TileViewItems in the collection (RadTileView.Items) except the last one. And when there's only one item in the collection, the proposed solution doesn't work at all.

    Using the following XAML, the mouse dragging functions on Map1, but not on Map2:
    <telerik:RadTileView x:Name="TileView">   
        <telerik:RadTileViewItem Header="Map" x:Name="Map1">   
            <telerik:RadMap>   
                <telerik:RadMap.Provider>   
                    <telerik:OpenStreetMapProvider />   
                </telerik:RadMap.Provider>   
            </telerik:RadMap>   
        </telerik:RadTileViewItem>   
        <telerik:RadTileViewItem Header="Map" x:Name="Map2">     
            <telerik:RadMap>   
                <telerik:RadMap.Provider>   
                    <telerik:OpenStreetMapProvider />   
                </telerik:RadMap.Provider>   
            </telerik:RadMap>   
        </telerik:RadTileViewItem>   
    </telerik:RadTileView>

    Is there another way to permit the dragging of the Maps when placed inside TileViewItems?

    Best regards
  2. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 08 Sep 2011 Link to this post

    Hi Tanguy,

    Based on the supplied information, it is hard to determine what is causing this behavior. In order to properly address the issue at hand, it will be best if you open a formal support ticket, and send us a small working project, demonstrating your setup, and showing the unwanted behavior. We will debug it locally, and get back to you with our findings.

    Kind regards,
    Yavor
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft banner
Back to Top