locked
Custom Layout Pane RRS feed

  • Question

  • Hi,

     

    I'm trying to create custom layout pane having certain behavior..

     

    Let's think of this like grid with 3 rows and 3 columns...

     

    Active part should be displayed in row 1, column 1 but will have columnspan = 2, and rowspan = 2.

    Other parts should be displayed all around this square, each part in one cell (secondpart:row3,column1,  thirdpart:row3,column2 ..... fifthpart:row3,column3 or similiar).

     

    if I click on part that is not active I want to create animation(transition) which will changes parts places (activePart should be minimized to clicked part cell, and clicked will become larger in active area (row1, colum1 with spans...))

     

    First I want to know is this scenario possible at all?

     

    I beleive I  must start from LayoutPane...

    but do not have a clue what is the minimum for implementation for this to work ...

     

    I need a hint how can this be acomplished using transitions in acropolis (or how to create one doing this)?

     

     

    Thanks,

     

    s.m.

     

     

     

    Friday, July 20, 2007 11:53 AM

Answers

  • Hi LessXa,

     

    I would approach this scenario using a Grid. Row1:column1 will have a part pane bound to NavigationManager.ActivePart with a transition. This will ensure your Row1:Column1 displays the active part (you would use SingleActivePartNavigationManager) Other cells in the grid should also be hosting partpanes. This is what I mean (on a simple two-cell grid):

     

    Code Snippet

    <Grid Grid.Row="2">

    <Grid.RowDefinitions>

    <RowDefinition Height="Auto"/>

    <RowDefinition Height="Auto"/>

    </< FONT>Grid.RowDefinitions>

    <Awx:PartPane Part="{Binding Part.NavigationManager.ActivePart}" Grid.Row="0"/>

    <Awx:PartPane MouseDown="PartPaneClick" Part="{Binding Part.NavigationManager.NavigationModel[0].AssociatedPart}" Grid.Row="1"/>

    </< FONT></Grid>

     

     

     

    You would need to write your custom UI logic to handle clicks on non-active part panes to make them active, something similar to:

     

    Code Snippet

    void PartPaneClick(object sender, RoutedEventArgs e)

    {

    PartPane partPane = (PartPane)sender;

    IPart hostedPart = partPane.Part;

    NavigationItem item = PartViewContract.Part.NavigationManager.FindItemByName(hostedPart.Name);

    PartViewContract.Part.NavigationManager.NavigateTo(item);

    }

     

    Hope this helps!

     

    Sunday, July 22, 2007 4:48 PM

All replies

  • Hi LessXa,

     

    I would approach this scenario using a Grid. Row1:column1 will have a part pane bound to NavigationManager.ActivePart with a transition. This will ensure your Row1:Column1 displays the active part (you would use SingleActivePartNavigationManager) Other cells in the grid should also be hosting partpanes. This is what I mean (on a simple two-cell grid):

     

    Code Snippet

    <Grid Grid.Row="2">

    <Grid.RowDefinitions>

    <RowDefinition Height="Auto"/>

    <RowDefinition Height="Auto"/>

    </< FONT>Grid.RowDefinitions>

    <Awx:PartPane Part="{Binding Part.NavigationManager.ActivePart}" Grid.Row="0"/>

    <Awx:PartPane MouseDown="PartPaneClick" Part="{Binding Part.NavigationManager.NavigationModel[0].AssociatedPart}" Grid.Row="1"/>

    </< FONT></Grid>

     

     

     

    You would need to write your custom UI logic to handle clicks on non-active part panes to make them active, something similar to:

     

    Code Snippet

    void PartPaneClick(object sender, RoutedEventArgs e)

    {

    PartPane partPane = (PartPane)sender;

    IPart hostedPart = partPane.Part;

    NavigationItem item = PartViewContract.Part.NavigationManager.FindItemByName(hostedPart.Name);

    PartViewContract.Part.NavigationManager.NavigateTo(item);

    }

     

    Hope this helps!

     

    Sunday, July 22, 2007 4:48 PM
  • Hi Alex,

     

    Thanks for your answer,

     

    Would it be wrong if I create some RootPart and handle this in its View, and than

    we can create custom layouts as parts/Views and simply switch to another layout by changing that part View ...

     

    Is this what you ment ?

     

    Monday, July 23, 2007 7:16 AM
  • Yes, I meant to create the RootPart and handle the layout logic in its view (or it could as well be done in the Application shell). But I cannot think how view switching could be used in this scenario. Typical view switching scenario is when you have a display the same content differently, e.g. design view and code view.

    From your original description I understood that you would like to create a portal application that would host multiple parts that may not be related to each other and you would like have this specific layout logic where the active part's view always appears in the top left cell of the grid while the others surround it.

    Monday, July 23, 2007 3:23 PM
  • Hi, Alex,

     

    Ok. 

    I have done this as Part and it works fine.

    What I ment about changing views is that we can implement another layout logic for the same part...

    Default view can handle layout as I described in the begining (using Grid). Another view can be a completly new layout. (implemented using TabLayoutPane, or SplitLayoutPane ... having of course diferent behaviour ...)

     

     Thanks again...

     

    Tuesday, July 24, 2007 6:32 AM