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

Vertical Group Layout

3 Answers 170 Views
Panorama
This is a migrated thread and some comments may be shown as answers.
George C.
Top achievements
Rank 2
Iron
Veteran
George C. asked on 04 Dec 2019, 02:57 PM

Greetings.

Using the code below, it is possible to set vertical group layout :

RadPanorama1.PanoramaElement.GroupLayout.Orientation = Orientation.Vertical

 

BUT,

what would be the usage as it disables the scroll ball. I found relevant threads, but It would be helpful for VB.NET developers if you just not provide solutions in C#, but also in VB.NET (I already know C# can be converted to VB.NET, but it isn't comfortable in many cases).

For instance, I edited the relevant thread to create custom Panoroma :

Imports Telerik.WinControls
Imports Telerik.WinControls.Layouts
Imports Telerik.WinControls.UI
 
Class CustomPanorama
    Inherits RadPanorama
 
    Private vScroll As RadScrollBarElement
 
    Protected Overrides Sub CreateChildItems(ByVal parent As Telerik.WinControls.RadElement)
        MyBase.CreateChildItems(parent)
        Me.vScroll = New RadScrollBarElement()
        Me.vScroll.ScrollType = ScrollType.Vertical
        Me.vScroll.StretchHorizontally = False
        Me.vScroll.StretchVertically = True
        Me.vScroll.MinSize = New System.Drawing.Size(16, 0)
        Me.vScroll.Alignment = System.Drawing.ContentAlignment.TopRight
        Me.PanoramaElement.Children.Add(vScroll)
        AddHandler vScroll.ValueChanged, AddressOf vScroll_ValueChanged
        AddHandler PanoramaElement.GroupLayout.RadPropertyChanged, AddressOf GroupLayout_RadPropertyChanged
        AddHandler PanoramaElement.TileLayout.RadPropertyChanged, AddressOf GroupLayout_RadPropertyChanged
        Me.ScrollBarAlignment = HorizontalScrollAlignment.Bottom
    End Sub
 
    Private Sub GroupLayout_RadPropertyChanged(ByVal sender As Object, ByVal e As Telerik.WinControls.RadPropertyChangedEventArgs)
        If e.Equals(RadElement.BoundsProperty) AndAlso sender = Me.GetCurrentLayout() Then
            UpdateVScroll()
        End If
    End Sub
 
    Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
        MyBase.OnSizeChanged(e)
        UpdateVScroll()
    End Sub
 
    Private Sub UpdateVScroll()
        vScroll.Maximum = Me.GetCurrentLayout().Size.Height
        vScroll.LargeChange = Math.Max(0, CInt((Me.Size.Height - Me.PanoramaElement.ScrollBar.Size.Height)))
 
        If vScroll.LargeChange >= vScroll.Maximum Then
            vScroll.Visibility = ElementVisibility.Hidden
        Else
            vScroll.Visibility = ElementVisibility.Visible
        End If
 
        If Me.PanoramaElement.ScrollBar.Visibility = ElementVisibility.Visible Then
            vScroll.Margin = New System.Windows.Forms.Padding(0, 0, 0, Me.PanoramaElement.ScrollBar.Size.Height)
        Else
            vScroll.Margin = New System.Windows.Forms.Padding(0)
        End If
    End Sub
 
    Private Sub vScroll_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
        Me.GetCurrentLayout().PositionOffset = New System.Drawing.SizeF(0, -Me.vScroll.Value)
    End Sub
 
    Private Function GetCurrentLayout() As LayoutPanel
        If Me.ShowGroups Then
            Return Me.PanoramaElement.GroupLayout
        End If
 
        Return Me.PanoramaElement.TileLayout
    End Function
 
    Public Overrides Property ThemeClassName As String
        Get
            Return GetType(RadPanorama).FullName
        End Get
        Set(ByVal value As String)
            MyBase.ThemeClassName = value
        End Set
    End Property
End Class

 

But, in this way, we have to create all elements such as tiles programmatically, really difficult and annoying in comparison with visual creation.

 

How to enable vertical scrollbar for vertical Group Layout ?

 

Thanks in advance. 

3 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Dec 2019, 01:45 PM
Hello, George, 

As you have already found out, we already have a similar feature request logged in our feedback portal. You can track its progress, subscribe for status changes and add your comments on the previously referred feedback item. The more votes an item gathers the higher its priority becomes. 

Following the provided workaround in the item, I have prepared a sample project in VB.NET which achieves vertical groups scrolling in RadPanorama. The achieved result is illustrated in the attached gif file. Note that this is just a sample approach and it may not cover all possible cases. Feel free to modify it in a way which suits your requirements best.

Feel free to use the online code converter for converting any piece of code from C# to VB.NET and vice versa. Usually it is very helpful for our customers: http://converter.telerik.com/ 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
George C.
Top achievements
Rank 2
Iron
Veteran
answered on 05 Dec 2019, 05:26 PM

Thanks.

How can I scroll the Panoroma with mouse wheel, in this case ?

0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Dec 2019, 09:24 AM

Hello, George, 

By default, RadPanorama handles mouse wheel and it zooms in/out considering the delta. This is controlled by the MouseWheelBehavior property. However, since the vertical scrollbar is a custom implementation, it should be handled when firing the MouseWheel event in RadPanorama
In the custom RadPanorama, you need to override the OnMouseWheel as follows:

    Protected Overrides Sub OnMouseWheel(e As MouseEventArgs)
        Dim newValue As Integer = Me.vScroll.Value + Math.Sign(e.Delta) * -30
        newValue = Math.Max(0, Math.Min(Me.vScroll.Maximum - Me.vScroll.LargeChange + 1, newValue))
        Me.vScroll.Value = newValue
        MyBase.OnMouseWheel(e)
    End Sub
Should you have further questions please let me know.


Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Panorama
Asked by
George C.
Top achievements
Rank 2
Iron
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
George C.
Top achievements
Rank 2
Iron
Veteran
Share this question
or