positions setting in run time

2 posts, 0 answers
  1. rachel
    rachel avatar
    36 posts
    Member since:
    Sep 2010

    Posted 19 Dec 2011 Link to this post


    i do binding to tileview Position. in system loading i set positions to the objects and i want the items will be shown order by those positions.
    if i'm using with itemsSource, it works fine.
    but if i'm using with prism region, the items do not shown as well and some items hidden under other items.

    is there any solution to this?
  2. Tina Stancheva
    Tina Stancheva avatar
    3299 posts

    Posted 22 Dec 2011 Link to this post

    Hi Rachel,

    When you're populating the RadTileView region with modules following the PRISM guidelines, you need to keep in mind that the RadTileView.Items will be ordered based on the order in which their modules are loaded. Basically as soon as a module is loaded it is added to its region - in this case to the RadTileView.Items collection. And when you bind the items Position property and try to control it as well, it may not work as expected. In order to use the Position property you need to have all items loaded so that you can place let's say Tile1 on the 3rd position. But in a PRISM scenario, when you load module1 that defines RadTileViewItem1, the other modules may not yet be loaded and no RadTileViewItem containers are created for them. This is why the RadTileView won't know how to place the first item on the 3rd position, how much space should be left for the other items if there are any other items and so on.

    I believe in your case the delay in loading all modules(RadTileViewItems) in a PRISM scenario is causing the issues. And this is why if you want to control the initial position of the items in this case, it is better to modify the Bootstrapper CreateModuleCatalog() method to load the modules using dependencies. Taking advantage of this feature of the PRISM framework will allow you to control the order in which the modules are loaded and therefore the order in which the RadTileViewItems are initialized and ordered in the RadTileView region.
    Below you can see an example of how to populate the RadTileView with 3 modules that will create 3 RadTileViewItems in the following order - TileItem2, TileItem3, TileItem1
    protected override IModuleCatalog CreateModuleCatalog()
        ModuleCatalog catalog = new ModuleCatalog();
        catalog.AddModule(typeof(Module3.Module3), "Module2");
        catalog.AddModule(typeof(Module1.Module1), "Module3");
        return catalog;

    And once all modules are loaded you can change the Position property of the items through binding or directly.

    Tina Stancheva
    the Telerik team

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

Back to Top