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

Layout problem with PreservePositionWhenMaximized and dynamically added items

3 Answers 98 Views
TileView
This is a migrated thread and some comments may be shown as answers.
Wenrong
Top achievements
Rank 1
Wenrong asked on 26 Jun 2012, 03:32 AM
When the tile view has got PreservePositionWhenMaximized set to True, it would have a funny layout behaviour when new item is added to the view maximized.

Below is simple test code to reproduce this, it looks ok when the first and second tile is added, but when the third tile is added, the minimized second tile is placed at the same position as the first minimized tile and covered it up:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="26" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
     
    <Button Content="Add" Click="Button_Click" />
 
    <telerik:RadTileView Name="tileview" Grid.Row="1"
                         PreservePositionWhenMaximized="True"
                         MinimizedColumnWidth="300"
                         MinimizedRowHeight="45"/>
</Grid>

private void Button_Click(object sender, RoutedEventArgs e)
{
    tileview.Items.Add(new RadTileViewItem() { TileState = TileViewItemState.Maximized });
}

3 Answers, 1 is accepted

Sort by
0
Zarko
Telerik team
answered on 27 Jun 2012, 03:20 PM
Hello,
Thank you for the feedback! I logged this issue in your PITS under the name "Wrong layout when adding Maximized RadTileViewItems and PreservePositionWhenMaximized is set to True" and it'll be ready for tracking and voting tomorrow the latest.
As for now I can advice you to add maximized items like this:
private void Button_Click(object sender, RoutedEventArgs e)
{
    var newItem = new RadTileViewItem() { TileState = TileViewItemState.Maximized, Header = this.tileview.Items.Count };
    this.tileview.Items.Add(newItem);
    this.tileview.MaximizedItem = newItem;
}
I've updated you telerik account 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
Wenrong
Top achievements
Rank 1
answered on 27 Jun 2012, 08:41 PM
I'm afraid that the temporary solution you suggested isn't going to work for me as in my real project, I am using MVVM and the tile items is bind to a collection. The code in the OP is just for demonstration of the issue.

Anyway, maybe I will just live without PreservePositionWhenMaximized  for now until it's fixed.
0
Accepted
Zarko
Telerik team
answered on 29 Jun 2012, 03:01 PM
Hello Wenrong,
You can still use this workaround but you'll have to also bind the MaximizedItem of the RadTileView:
<telerik:RadTileView Name="tileview"
                 ItemsSource="{Binding Items}"
                 MaximizedItem="{Binding MaximizedItem, Mode=TwoWay}"
                 PreservePositionWhenMaximized="True">
and
internal void AddItem()
{
    var newItem = new MyItem() { Name = "Item " + this.Items.Count };
    this.Items.Add(newItem);
    this.MaximizedItem = newItem;
}
If need further assistance please feel free to ask.

Kind regards,
Zarko
the Telerik team

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

Tags
TileView
Asked by
Wenrong
Top achievements
Rank 1
Answers by
Zarko
Telerik team
Wenrong
Top achievements
Rank 1
Share this question
or