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

Dynamic Panorama Controls

16 Answers 559 Views
Panorama
This is a migrated thread and some comments may be shown as answers.
Gerhard
Top achievements
Rank 1
Gerhard asked on 10 Feb 2012, 12:12 PM
I have a folder with shortcuts in witch I use to build my menu in the panorama control. When I break the code it shows all the shortcuts are in the control, but only the last one shows.

16 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 15 Feb 2012, 10:13 AM
Hi Gerhard,

Thank you for your question.

Most probably, your tiles are all set to appear in the first cell, they stack over each other and only the last one remains visible. The RadPanorama control arranges its tiles in a GridLayout panel and each tile can be set with a column and row in which it should appear. The following example demonstrates how to fill RadPanorama programatically with having the items properly arranged:
for (int i = 0; i < 30; i++)
{
    RadTileElement tile = new RadTileElement();
    tile.Text = "Item " + i;
    tile.Row = i % this.radPanorama1.RowsCount;
    tile.Column = i / this.radPanorama1.RowsCount;
 
    this.radPanorama1.Items.Add(tile);
}

I hope this will help you. Please let me know if you need further assistance.

Kind regards,
Ivan Todorov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Steve
Top achievements
Rank 1
answered on 27 Jun 2012, 10:43 AM

Hiya,

I am using the above proposed approach to dynamically add tiles to a TileGroupElement in a Panorama control. When the form loads I iterate a folder to a get all images and call the following code to add new tiles, which works as expected:

private void AddNewImageTile(string ImagePath) {
    if (File.Exists(ImagePath)) {
        RadTileElement newTile = new RadTileElement();
        newTile.AutoSize = true;
        newTile.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.Auto;
        newTile.GradientStyle = Telerik.WinControls.GradientStyles.Linear;
 
        newTile.Image = this.GetThumbnail(ImagePath);
        newTile.ImageAlignment = System.Drawing.ContentAlignment.BottomLeft;
        newTile.Padding = new System.Windows.Forms.Padding(15);
        newTile.Size = new System.Drawing.Size(300, 250);
        newTile.TextImageRelation = System.Windows.Forms.TextImageRelation.TextAboveImage;
        //newTile.Text = ImagePath;
         
        newTile.Row = tileGroupElement1.Items.Count % this.radPanorama1.RowsCount;
        newTile.Column = tileGroupElement1.Items.Count / this.radPanorama1.RowsCount;
 
        newTile.Click += new System.EventHandler(carouselItem_Click);
        this.tileGroupElement1.Items.Add(newTile);             
         
    }
}

 

However, when I invoke the same function lets say on a button click, i can see a new tile being added to the TileGroupElement, however at the same time the following error is being raised:

 

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
 
************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at Telerik.WinControls.Layouts.GridLayout.MeasureElements()
   at Telerik.WinControls.Layouts.GridLayout.MeasureOverride(SizeF availableSize)
   at Telerik.WinControls.RadElement.MeasureCore(SizeF availableSize)
   at Telerik.WinControls.RadElement.Measure(SizeF availableSize)
   at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayout()
   at Telerik.WinControls.Layouts.ContextLayoutManager.UpdateLayoutCallback(ILayoutManager manager)

the error is only raised when a new column is created to add the new tile. is there anything else that needs configuring for the TileGroupElement ?
i am using RadControls version 2012.2.608.40.

0
Ivan Todorov
Telerik team
answered on 29 Jun 2012, 01:42 PM
Hello Steve,

Thank you for contacting us.

There was an issue in the layout of RadPanorama which was causing such exception when you dynamically add items. You can workaround it by suspending the layout of the RadPanoramaElement while adding tiles. The issue is no longer present in the latest version.

I have also noticed a small issue in the sample code you have posted. Please note that the RadPanorama.RowsCount property sets the number of rows when you are not using groups. In grouped view, each group has its own RowsCount property and in your case you should use tileGroupElement1.RowsCount.

The following code snippet demonstrates how to overcome the above mentioned issue:
public Form1()
{
    InitializeComponent();
    this.tileGroupElement1.RowsCount = 5;
}
 
private void radButton1_Click(object sender, EventArgs e)
{
    this.radPanorama1.PanoramaElement.SuspendLayout(true);
 
    foreach (string img in Directory.GetFiles(@"C:\images", "*.png"))
    {
        AddNewImageTile(img);
    }
 
    this.radPanorama1.PanoramaElement.ResumeLayout(true, true);
}
 
private void AddNewImageTile(string ImagePath)
{
    if (File.Exists(ImagePath))
    {
        RadTileElement newTile = new RadTileElement();
        newTile.AutoSize = true;
        newTile.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.Auto;
        newTile.GradientStyle = Telerik.WinControls.GradientStyles.Linear;
 
        newTile.Image = Image.FromFile(ImagePath).GetThumbnailImage(64, 64, null, IntPtr.Zero);
        newTile.ImageAlignment = System.Drawing.ContentAlignment.BottomLeft;
        newTile.Padding = new System.Windows.Forms.Padding(15);
        newTile.TextImageRelation = System.Windows.Forms.TextImageRelation.TextAboveImage;
 
        newTile.Row = tileGroupElement1.Items.Count % this.tileGroupElement1.RowsCount;
        newTile.Column = tileGroupElement1.Items.Count / this.tileGroupElement1.RowsCount;
          
        this.tileGroupElement1.Items.Add(newTile);
    }
}

A bit offtopic, I would like to remind you that your trial support package has expired. If you would like to continue receiving support from us, you will have to consider a purchase of some of the licenses that we offer. You can find the available options at this URL - http://www.telerik.com/purchase.aspx. These licenses come with Dev priority support where the tickets should be answered in a guaranteed period of time. Shortly said, we will provide you with quicker responses.

Hope this helps. Feel free to ask if you have any further questions.

All the best,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Steve
Top achievements
Rank 1
answered on 29 Jun 2012, 01:50 PM
Ivan,

Thanks for the reply.
According to my account I still have support subscriptions until next year - please can you contact me outside of the forums to sort that out?

Thanks
Steve
0
Ivan Todorov
Telerik team
answered on 03 Jul 2012, 11:39 AM
Hi Steve,

Indeed, you have a valid license until next year. The notification of the expired license is concerning the owner of this thread - Gerhard. Please excuse me for my mistake and for any inconvenience caused.

Should you have any future questions, do not hesitate to contact us.

All the best,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Antz
Top achievements
Rank 1
answered on 14 Feb 2013, 02:07 PM
Dear Ivan Todorov,

I have question for this issue too. How about VB code to add Group,Tile Item and event click for Panorama Controls dynamically.
May you give me a sample code for this issue.
Thank you so much..

Best Regards.
0
Ivan Todorov
Telerik team
answered on 15 Feb 2013, 02:16 PM
Hello Antz,

The following code demonstrates how to add groups and tiles via code and also how to subscribe to each tile's Click event:
Public Class Form1
 
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.RadPanorama1.ShowGroups = True
        For index = 1 To 10
 
            Dim group As New TileGroupElement
            Me.RadPanorama1.Groups.Add(group)
            group.RowsCount = 3
            group.Text = "Group " & index
 
            For j As Integer = 0 To 12
                Dim tile As New RadTileElement()
                tile.Text = "Item " & j
                tile.Row = j Mod group.RowsCount
                tile.Column = j \ group.RowsCount
                group.Items.Add(tile)
 
                AddHandler tile.Click, AddressOf tile_Click
            Next
 
        Next
 
    End Sub
 
    Private Sub tile_Click(sender As Object, e As EventArgs)
        Dim tile = CType(sender, RadTileElement)
        RadMessageBox.Show(tile.Text & " was clicked")
    End Sub
 
End Class

I hope you find it useful. If you have any other questions, feel free to ask.

All the best,
Ivan Todorov
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Antz
Top achievements
Rank 1
answered on 17 Feb 2013, 01:53 AM
Dear Ivan,

Thank you very much.. very useful for me..
0
monika
Top achievements
Rank 1
answered on 20 Mar 2015, 12:06 PM
Hello sir,
As i am adding tiles dynamically from database to groups like :-


RadTileElement tile = new RadTileElement();
tile.Text = "Testing";
Group.Items.Add(tile);

How can i get click event of the tile added in group.

Thanks and regards
monika
0
Hristo
Telerik team
answered on 25 Mar 2015, 07:57 AM
Hello Monika,

Thank you for writing.

You can attach a click event handler to each tile added in a group. Please see my snippet below:
public partial class Form1 : Form
{
    private TileGroupElement group;
 
    public Form1()
    {
        InitializeComponent();
 
        this.group = new TileGroupElement();
        this.radPanorama1.Groups.Add(group);
        group.Text = "Group";
        this.radPanorama1.ShowGroups = true;
    }
 
    private void radButton1_Click(object sender, EventArgs e)
    {
        RadTileElement tile = new RadTileElement();
        tile.Text = "Testing";
        this.group.Items.Add(tile);
 
        tile.Click += tile_Click;
    }
 
    private void tile_Click(object sender, EventArgs e)
    {
        RadTileElement tile = (RadTileElement)sender;
        RadMessageBox.Show(tile.Text + " was clicked");
    }
}

I am also sending you a gif file of the result on my end.

I hope this helps. Should you have further questions please do not hesitate to write back.


Regards,
Hristo Merdjanov
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Muhammad
Top achievements
Rank 1
answered on 22 Feb 2016, 11:29 AM

Hi Hristo Merdjanov,

Thank you for replu all question.I have two questions

1.  I am using radPanorama which has many tiles and i am giving functionality to user customize his application desktop (Dashboard). when user increase the size of radTile by using trackbar. The tile is overlaping to next tile. have you any suggestion to rearrange all tiles?

2. when user right click on RadTile the click event is fired. have any property to prevent the fire click event on right click ?

0
Hristo
Telerik team
answered on 22 Feb 2016, 04:16 PM
Hello Muhammad,

Thank you for writing.

The position of the tiles is defined using their Row and Column properties. A tile can also have a ColSpan and RowSpan determining how many cells it would take. Please check this documentation article: Settings and this forum post discussing a similar topic: Tile reposition and resizing.

As to your second question, you can cast the arguments of the click handler to MouseEventArgs and check for the pressed mouse button: 
private void tile_Click(object sender, EventArgs e)
{
    if (((MouseEventArgs)e).Button == System.Windows.Forms.MouseButtons.Left)
    {
        RadTileElement tile = (RadTileElement)sender;
        RadMessageBox.Show(tile.Text + " was clicked");
    }
}

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Muhammad
Top achievements
Rank 1
answered on 25 Feb 2016, 09:25 AM

Hi Hristo Merdjanov,

 

thank you for reply

i am managing the Row,Column ,RowSpan and ColSpan. But if i am increase the size of selected tile from track bar the next tile still his postion so increases tile overlap to next tile.

Right click solution is fine.

I have another issue if i click on radPanorama and move the mouse scroll radPanoram increase the size like zooming. So Guide me

thanks

Regards,

M.Amin

0
Hristo
Telerik team
answered on 25 Feb 2016, 05:34 PM
Hi Muhammad,

Thank you for writing.

I am afraid I do not completely understand your scenario. Could you please open up a support ticket and send us your project so that we can investigate it locally. Please also refer this forum thread in your ticket.

Looking forward to your reply.

Regards,
Hristo Merdjanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Muhammad
Top achievements
Rank 1
answered on 06 Apr 2016, 03:46 PM

Hi Ivan Todorov,

Problem: Does not able to Drag radTileElement to left or right using touch screen

Description:

     When ever I have to move an radTileElement using touch screen .I have to either move my finger to 

release the radTileElement so I can move it in any direction where I want. When I grab an radTileElement 
and move left or right it stays locked in its position.

Can you give me any solution for drag radTileElement to left or right. 

Regards,

M.Amin

0
Hristo
Telerik team
answered on 08 Apr 2016, 02:03 PM
Hi M.Amin,

I tested our demo application on tablet and it worked fine. Please note that you would need to press and hold your finger on a tile element in order to unlock it and be able to move it back and forth.

In case you keep experiencing issues. Please open up a support ticket and send us your project.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
Panorama
Asked by
Gerhard
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Steve
Top achievements
Rank 1
Antz
Top achievements
Rank 1
monika
Top achievements
Rank 1
Hristo
Telerik team
Muhammad
Top achievements
Rank 1
Share this question
or