Reset Layout

6 posts, 1 answers
  1. Chris
    Chris avatar
    51 posts
    Member since:
    Sep 2010

    Posted 14 Sep 2010 Link to this post

    Hi,

    I am looking for the best way to reset the layout of a view that contains a RadTileView control, sitting along side a RadExpander. navigating away from the screen and then back should present the screen in its original form. Setting the tiles states back to their original values i.e. maximised or minimised does not affect their width and as the tiles contain RadFluidContentControls the user is presented with incorrect content initially. I have tried setting the width of the tile view items manually but this does not work as expected and can push one of the tiles out of view.

    Regards,
    Chris
  2. Answer
    Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 16 Sep 2010 Link to this post

    Hello Chris,

    I've prepared a small project that demonstrates how to bind the State of the FluidContentControl to the TileState of the TileViewItem. In this way, you will be 100% sure that the correct content is shown and not worry about thresholds. Have a look at it and let me know how it works for you.

    Regards,
    Kiril Stanoev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Chris
    Chris avatar
    51 posts
    Member since:
    Sep 2010

    Posted 17 Sep 2010 Link to this post

    Hi Kiril,

    In terms of resetting the layout this solution works perfectly, so thank you for taking the time to knock up the demo.

    The one thing the solution doesn't handle is getting the order of the tiles back to how they were originally.

    Would this be a simple task to achieve?

    Regards,
    Chris
  5. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 23 Sep 2010 Link to this post

    Hi Chris,

     I've tried it with binding the Position property of the Containers to the ViewModels' but unfortunately the TileViewItems doesn't respect it. The only solution I came up is resetting the ItemsSource like follows. (Just replace the MainPage.cs)

    public partial class MainPage : UserControl
    {
        IList<MyViewModel> items;
     
        public MainPage()
        {
            InitializeComponent();
     
            this.radTileView.ItemsSource = items = MyViewModel.GenerateItems();
        }
     
        private void ResetLayout_Click(object sender, RoutedEventArgs e)
        {
            foreach (var item in this.items)
            {
                item.ContentState = ContentState.NormalContent;            
            }           
     
            this.radTileView.ItemsSource = null;
            this.radTileView.ItemsSource = this.items;
        }
    }

    Hope will help you.

    Greetings,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Chris
    Chris avatar
    51 posts
    Member since:
    Sep 2010

    Posted 23 Sep 2010 Link to this post

    Hi Miro,

    We have found our own solution for this issue, by using the ViewModel to determine the position of the tiles, as opposed to the tiles knowing themselves. When we load the content dynamically the content creates its own RadTileViewItem and injects its content. The content the added to the page is ordered based on the Position element of each of the tiles at the point of saving the ayout previsouly.

    Te position of the content object is maintained by updating the ViewModel whenever the PositionChanged event of the tiles if fired. Seems to work nicely!

    Regards,
    Chris
  7. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 23 Sep 2010 Link to this post

    Hello Chris,

     Happy to hear that. I've also created work item to check our own logic inside the control and more precisely - the way we deal with changing the Position property of the TileViewItem.
    If you need more help, please let us know.

    Greetings,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner