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

Set tile width programmatically

3 Answers 70 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 1
Joseph asked on 26 Jun 2012, 08:02 PM
I have a tile view with the ColumnsCount set to 3.  I would like to make each middle tile twice the length of the two outer tiles programmatically, but I can't seem to figure it out.  This is what I have been trying:
private void RadFluidContentControl_Loaded(object sender, RoutedEventArgs e)
{
    RadFluidContentControl rfcc = sender as RadFluidContentControl;
    RadTileViewItem rtvi = rfcc.ParentOfType<RadTileViewItem>();
  
    if (rtvi.Position % 3 == 1)
        rtvi.RestoredWidth = 2 * Double.PositiveInfinity;
    else
        rtvi.RestoredWidth = 1 * Double.PositiveInfinity;
}
However, this just makes each tile have a the same width.  What am I doing wrong?

3 Answers, 1 is accepted

Sort by
0
Accepted
Zarko
Telerik team
answered on 29 Jun 2012, 01:14 PM
Hi Joseph,
If you want your RadTileViewItems to have different sizes you'll have to set their RestoredWidth/Height and set the RadTileVIew's ColumnWIdth/RowHeight to Auto. You can read more here.
I've attached a sample project so you could examine it and if you have further questions please feel free to ask.

All the best,
Zarko
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Joseph
Top achievements
Rank 1
answered on 29 Jun 2012, 04:03 PM
Thanks, but I'd like the tile widths to scale depending on the size of the window.  How would I go about doing that?
0
Joseph
Top achievements
Rank 1
answered on 29 Jun 2012, 04:52 PM
Never mind, I missed the IsItemsSizeInPercentages property.  Thank you for your help.
Tags
TileView
Asked by
Joseph
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Joseph
Top achievements
Rank 1
Share this question
or