TileViewItem Sizing and Alignment

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    1 posts
    Member since:
    Mar 2012

    Posted 04 Mar 2012 Link to this post


    I have a couple of questions concerning TileView/TileViewItem that i hope someone can help me with. We are using the installation package titled 2011_3_1220.


    I am trying to do something relatively simple with the TIleView/TileViewItems, and having no end of failures, which I can only attribute to me not understanding something. I am storing a FluidContentControl (manual content change mode) as the Content of a TileViewItem. The "small" content of the FluidContentControl is a simple Grid/Border/TextBlock arrangement. I do not set *any* explicit widths/heights, on the *presumption* that my content would "fill out" whatever area was offered to it by the TileViewItem.

    (I have set TileView.MinimizedRowSize to 150 - which is the subject of another question below).

    What I want, very simply, is for my "small" content in the FluidItemControl to size according to the space being allocated to the TileViewItem (whose Content is the FluidItemControl). What I get at present are TileViewItems of different widths according to the length of the text I put in the TextBlock.

    I have tried every combination of HorizontalAlignment/VeriticalAlignment stretch I can think of (eg. against the Grid, against the FluidContentControl, etc) and the only way I can get a result resembling what I want is to explicitly set the width of my FluidContentControl or the width of the Grid (the latter being better as it doesn't affect the maximised view). But that doesn't really help because the width of the TIleViewItem varies dynamically - it seems to be about 20% of the layout width of the TileView.


    I have put a bunch (say 20) tiles into the TileView and set each of their MinimizedHeight properties to 400. No scroll-bar ever appears for the minimized TileViewItems, and the specified MinimizedHeight is never honored, resulting in my 20 tiles being packed in like sardines into the available real-estate (plus the abovementioned width problem). If I set TIleView.MinimizedRowSize to 150 as a test, the items get the correct size. Why can't I set the MinimizedHeight directly on each item? In my case they are all the same height at present, but what if I wanted different heights later? The minimized tiles run down the right-hand side of the TileView (default behaviour).

    Many thanks for assistance.

  2. Zarko
    Zarko avatar
    755 posts

    Posted 05 Mar 2012 Link to this post

    You can control the size of the minimized items with the MinimizedColumnWidth and MinimizedRowHeight properties. By default value of the MinimizedColumnWidth is Auto which means that the width of the minimized items will depend on their content - the problem that you're experiencing, so you should set it to something like 200 or 250 and everything should be ok.
    About the second question - the MinimizedHeight property of the items is taken into account only when the MinimizedRowHeight property is Auto (else the height of the minimized items comes from its value, not from the MinimizedHeight).
    I've attached a sample project that demonstrates this so could you please examine it and if you have more questions feel free to ask?

    Kind regards,
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top