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

RadTileElement events not firing....

1 Answer 128 Views
Panorama
This is a migrated thread and some comments may be shown as answers.
Info
Top achievements
Rank 1
Info asked on 17 Aug 2012, 01:22 PM
Hi,

I have started to write some code that eventually will build a menu of tiles using the Panaroma, Group and Tile controls. The strange thing is that when I add the tiles directly to the panorama everything works fine but when I first add the group and then add the tiles to the group then everything is shown ok but the tile events are not firing. There is no reponse to a click event or a mouse over. Could you help me with this?
Private Sub Menu_Load(sender As Object, e As System.EventArgs) Handles Me.Load
 
        Dim i As Integer
        Dim r As Integer
        Dim c As Integer = 0
 
        Dim groep As New TileGroupElement
 
        groep.Text = "hoi"
        RadPanorama1.Items.Add(groep)
 
        For i = 0 To 45
 
            If i Mod 4 = 0 Then
                If i <> 0 Then
                    r = r + 1
                End If
 
            End If
 
            groep.RowsCount = r + 1
 
            Dim tile As New RadTileElement
            tile.Text = CStr(i)
 
            tile.Row = r
 
            tile.Column = c
 
            c = c + 1
 
            If c = 4 Then c = 0
 
            tile.Tag = i
 
            AddHandler tile.Click, AddressOf tile_click
 
            groep.Items.Add(tile)
 
        Next
 
        Me.RadPanorama1.AllowDragDrop = False
 
        groep.ShouldHandleMouseInput = True
 
    End Sub
 
    Private Sub tile_click(sender As System.Object, e As System.EventArgs)
        RadPanorama1.PanoramaElement.SuspendLayout(True)
        MessageBox.Show(CType(sender, RadTileElement).Tag)
        RadPanorama1.PanoramaElement.ResumeLayout(True, True)
    End Sub

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 21 Aug 2012, 09:37 AM
Hi,

Thank you for writing.

The groups in RadPanorama should be added to the Groups collection of the control, not to the Items collection. Additionally, you should set the ShowGroups property to true:
Private Sub Menu_Load(sender As Object, e As System.EventArgs) Handles Me.Load
       RadPanorama1.ShowGroups = True
 
       Dim i As Integer
       Dim r As Integer
       Dim c As Integer = 0
 
       Dim groep As New TileGroupElement
 
       groep.Text = "hoi"
       RadPanorama1.Groups.Add(groep)
 
       For i = 0 To 45
 
           If i Mod 4 = 0 Then
               If i <> 0 Then
                   r = r + 1
               End If
 
           End If
 
           groep.RowsCount = r + 1
 
           Dim tile As New RadTileElement
           tile.Text = CStr(i)
 
           tile.Row = r
 
           tile.Column = c
 
           c = c + 1
 
           If c = 4 Then c = 0
 
           tile.Tag = i
 
           AddHandler tile.Click, AddressOf tile_click
 
           groep.Items.Add(tile)
 
       Next
 
       Me.RadPanorama1.AllowDragDrop = False
 
       groep.ShouldHandleMouseInput = True
 
   End Sub
 
   Private Sub tile_click(sender As System.Object, e As System.EventArgs)
       RadPanorama1.PanoramaElement.SuspendLayout(True)
       MessageBox.Show(CType(sender, RadTileElement).Tag)
       RadPanorama1.PanoramaElement.ResumeLayout(True, True)
   End Sub

We will consider throwing an exception when one attempts to add group to the Items collection in a future release. I have added a feature request here: http://www.telerik.com/support/pits.aspx#/public/winforms/12369.

Your Telerik Points have been updated accordingly.
 
Regards,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
Panorama
Asked by
Info
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or