Good day all
I am using the RadTileView but I am stuck. Basically we have a few items we are displaying (see pic 1) but because of the way the layout is done, as you can see it looks pretty bad. In addition I am using a MaxWidth/Height for the tiles. I am also using a datatemplate to wrap the fluidcontentcontrol. I have just an empty border for the Small and Content sections, and a grid for the Large one. Basically, we don't care to see anything in the small or normal layout - but these are always shown depending on the number of items in the panel. This is why I used fixed width and height. I have a few questions.
1. Since I do not know how to control the layout of the tiles, I used MaxH/W as previously mentioned.The problem is, with this, if you go to any other state (ex maximized), the size is still fixed (makes sense). However, on max I want to actually resize the tile. I came across another post with something like this:
I am using the RadTileView but I am stuck. Basically we have a few items we are displaying (see pic 1) but because of the way the layout is done, as you can see it looks pretty bad. In addition I am using a MaxWidth/Height for the tiles. I am also using a datatemplate to wrap the fluidcontentcontrol. I have just an empty border for the Small and Content sections, and a grid for the Large one. Basically, we don't care to see anything in the small or normal layout - but these are always shown depending on the number of items in the panel. This is why I used fixed width and height. I have a few questions.
1. Since I do not know how to control the layout of the tiles, I used MaxH/W as previously mentioned.The problem is, with this, if you go to any other state (ex maximized), the size is still fixed (makes sense). However, on max I want to actually resize the tile. I came across another post with something like this:
private
void
criticalProviderAlert_TileStateChanged(
object
sender, Telerik.Windows.RadRoutedEventArgs e)
{
RadTileViewItem maximizedItem = criticalProviderAlert.ItemContainerGenerator.ContainerFromItem(criticalProviderAlert.MaximizedItem)
as
RadTileViewItem;
if
(maximizedItem !=
null
)
{
maximizedItem.MaxHeight = 352;
maximizedItem.MaxWidth = 330;
return
;
}
}
So now I can change the size when the tile state is changed (pic 2). However, when I go back to the restored state - pic 3 is what happens. I wanted it to look as it did when I first started the app.
2. The next problem is layout. Notice that even though I have given the tiles explicit values, the control is treating the tiles as if they are using the default values based on what the panel computed. This is apparent in pic 3. Ideally, I would like it to look like pic 4. Is there a way to override/change the layout behavior so that it respects my explicit values rather than the default ones?
Thanks - this is a cool control.
UPDATE:
I have a working solution for 1 where I can resize the tiles as I see fit. I am doing this in code behind (we are using mvvm) since this is just a view related issue. The code is as follows but if anyone has any other ideas, please feel free to share:
private
void
providerAlert_TileStateChanged(
object
sender, Telerik.Windows.RadRoutedEventArgs e)
{
var s = e.Source;
RadTileViewItem maximizedItem =
providerAlert.ItemContainerGenerator.ContainerFromItem(providerAlert.MaximizedItem)
as
RadTileViewItem;
if
(maximizedItem !=
null
)
{
maximizedItem.MaxHeight = 352;
maximizedItem.MaxWidth = 330;
}
else
{
var tileItems = providerAlert.Items;
foreach
(var tile
in
tileItems)
{
var actualTile = providerAlert.ItemContainerGenerator.ContainerFromItem(tile)
as
RadTileViewItem;
if
(actualTile !=
null
)
{
actualTile.MaxHeight = 50;
}
}
}
}