Set tile width programmatically

4 posts, 1 answers
  1. Joseph
    Joseph avatar
    11 posts
    Member since:
    Feb 2012

    Posted 26 Jun 2012 Link to this post

    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?
  2. Answer
    Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 29 Jun 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Joseph
    Joseph avatar
    11 posts
    Member since:
    Feb 2012

    Posted 29 Jun 2012 Link to this post

    Thanks, but I'd like the tile widths to scale depending on the size of the window.  How would I go about doing that?
  5. Joseph
    Joseph avatar
    11 posts
    Member since:
    Feb 2012

    Posted 29 Jun 2012 Link to this post

    Never mind, I missed the IsItemsSizeInPercentages property.  Thank you for your help.
Back to Top