I've created a simple test application to test the RadPanorama.
My questions:
My found glitsches (see image):
For the sake of completeness, my source code:
My questions:
- Is there a way to say "This is the selected tile and this is the visual feedback for it"?
- How do I know which is the parent group of a tile?
- When rearranging the tiles via Drag&Drop there are always "gaps" in the layout. Is there a way to automatically "close" those gaps?
My found glitsches (see image):
- When using a RoundRectShape(12) and setting the Image of a tile, the image is drawn outside of the tile. I've also tested this with BackgroundImage instead of Image.
- When resizing the control, the scrollbar is going behind the tiles and there is no way to click the scrollbar.
For the sake of completeness, my source code:
//rama is the RadPanoramaControl
public
class
CustomItem
{
public
string
Group {
get
;
set
; }
public
Color Back {
get
;
set
; }
public
string
Name {
get
;
set
; }
public
int
Index {
get
;
set
; }
public
Image Picture {
get
;
set
; }
}
public
partial
class
Form1 : Form
{
private
const
int
COUNT = 30;
private
List<CustomItem> ItemList =
new
List<CustomItem>();
public
Form1()
{
InitializeComponent();
fillList();
}
private
void
fillList()
{
for
(
int
i = 0; i < COUNT; i++)
{
using
(Image image = Image.FromFile(@
"C:\Users\Public\Pictures\Sample Pictures\JellyFish.jpg"
))
{
Image thumb = image.GetThumbnailImage(120, 120, () =>
false
, IntPtr.Zero);
ItemList.Add(
new
CustomItem
{
Group =
"Group 1"
,
Back = Color.BlanchedAlmond,
Name =
"1-Item "
+ i,
Index = i,
Picture = thumb
});
}
}
for
(
int
i = 0; i < COUNT * 2; i++)
{
using
(Image image = Image.FromFile(@
"C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg"
))
{
Image thumb = image.GetThumbnailImage(120, 120, () =>
false
, IntPtr.Zero);
ItemList.Add(
new
CustomItem
{
Group =
"Group 2"
,
Back = Color.LightSkyBlue,
Name =
"2-Item "
+ i,
Index = i,
Picture = thumb
});
}
}
for
(
int
i = 0; i < COUNT; i++)
{
ItemList.Add(
new
CustomItem
{
Group =
"Group 3 has the looooooooooongest Name I've ever seen"
+ Environment.NewLine +
" and even a second line"
,
Back = Color.LimeGreen,
Name =
"3-Item "
+ i,
Index = i
});
}
for
(
int
i = 0; i < COUNT; i++)
{
using
(Image image = Image.FromFile(@
"C:\Users\Public\Pictures\Sample Pictures\Desert.jpg"
))
{
Image thumb = image.GetThumbnailImage(120, 120, () =>
false
, IntPtr.Zero);
ItemList.Add(
new
CustomItem
{
Group =
"Group 4"
,
Back = Color.LimeGreen,
Name =
"4-Item "
+ i,
Index = i,
Picture = thumb
});
}
}
}
private
void
fillControl()
{
var groups = (from x
in
ItemList
select x.Group).Distinct();
foreach
(var groupKey
in
groups)
{
int
rowcount = groupKey ==
"Group 4"
? 5 : 3;
rama.Groups.Add(
new
TileGroupElement { Name = groupKey, Text = groupKey, RowsCount = rowcount });
}
foreach
(var curViewItem
in
ItemList)
{
if
(curViewItem.Index % 2 == 0)
{
Image thumb1;
Image thumb2;
using
(Image image = Image.FromFile(@
"C:\Users\Public\Pictures\Sample Pictures\Desert.jpg"
))
{
thumb1 = image.GetThumbnailImage(120, 120, () =>
false
, IntPtr.Zero);
}
using
(Image image = Image.FromFile(@
"C:\Users\Public\Pictures\Sample Pictures\Koala.jpg"
))
{
thumb2 = image.GetThumbnailImage(120, 120, () =>
false
, IntPtr.Zero);
}
var liveTile =
new
RadLiveTileElement
{
//Text = curViewItem.Name,
BackColor = curViewItem.Back,
NumberOfColors = 1,
ColSpan = 1,
ForeColor = Color.CadetBlue,
Shape=
new
RoundRectShape(12)
//Image = curViewItem.Picture,
//ImageLayout = ImageLayout.Zoom,
//TextImageRelation = TextImageRelation.ImageAboveText
};
liveTile.Items.Add(
new
LightVisualElement
{
Text =
"Movie Idea: Pirates of the Carribean"
,
Image = thumb1,
ImageLayout = ImageLayout.Zoom
});
liveTile.Items.Add(
new
LightVisualElement
{
//Text = "Movie Idea: Inception",
Image = thumb2,
ImageLayout = ImageLayout.Zoom
});
liveTile.Items.Add(
new
LightVisualElement
{
Text =
"Movie Idea: The Expendables"
});
liveTile.Items.Add(
new
LightVisualElement
{
Text =
"Movie Idea: Harry Potter and the Deathly Hallows"
});
liveTile.AnimationFrames = 60;
//sets the number of frames in a transition
liveTile.AnimationInterval = 20;
//sets the interval between each frame in the transition in miliseconds
liveTile.ContentChangeInterval = 6000;
//sets the interval between each content change
liveTile.TransitionType = ContentTransitionType.SlideLeft;
//sets the type of the transition animation
((TileGroupElement)rama.Groups[curViewItem.Group]).Items.Add(liveTile);
}
else
{
((TileGroupElement)rama.Groups[curViewItem.Group]).Items.Add(
new
RadTileElement
{
Text = curViewItem.Name,
BackColor = curViewItem.Back,
NumberOfColors = 1,
ColSpan = curViewItem.Index % 3 == 0 ? 2 : 1,
//BackgroundImage = curViewItem.Picture,
//BackgroundImageLayout=ImageLayout.Zoom,
Image = curViewItem.Picture,
ImageLayout = ImageLayout.Zoom,
TextImageRelation = TextImageRelation.ImageAboveText,
Shape =
new
RoundRectShape(12)
});
}
}
}
private
void
Form1_Load(
object
sender, EventArgs e)
{
rama.ShowGroups =
true
;
rama.AllowDragDrop =
true
;
rama.ScrollBarAlignment = HorizontalScrollAlignment.Bottom;
fillControl();
}
}