I would love to use AnimatedTabControl, but cannot for the life of me figure out how to bind items to it

Topics: Prism v4 - WPF 4
Apr 28, 2011 at 7:58 PM

I created a WFP project created put the existing AnimatedTabControl.cs in a folder called Controls.  I created the

Shell.xaml

<Window x:Class="HelloWorld.Desktop.Shell"       xmlns:prism="http://www.codeplex.com/prism" xmlns:Controls="clr-namespace:HelloWorld.Desktop.Controls"         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         Title="Hello World" Height="350" Width="525">     <ItemsControl Name="TestTab2">         <Controls:AnimatedTabControl x:Name="TestTab"        SelectedIndex="0"        VerticalAlignment="Stretch"        prism:RegionManager.RegionName="MainRegion" />           </ItemsControl>        </Window>

 ////////////////////////////////////////////////////////////////////////////////////////////////////

Module

using Microsoft.Practices.Prism.Modularity;using Microsoft.Practices.Prism.Regions;
namespace HelloWorldModule{    public class HelloWorldModule : IModule    {        private readonly IRegionManager _regionManager;
        public void Initialize()        {            _regionManager.RegisterViewWithRegion("MainRegion", typeof(Views.HelloWorldView));        }
        public HelloWorldModule(IRegionManager regionManager)        {            this._regionManager = regionManager;        }    }}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////

user control

<UserControl x:Class="HelloWorldModule.Views.HelloWorldView"             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"              mc:Ignorable="d"              d:DesignHeight="300" d:DesignWidth="300">    <Grid>        <TextBlock Text="Hellow World" Foreground="Green" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Calibri" FontSize="24" FontWeight="Bold"></TextBlock>               </Grid></UserControl>

/////////////////////////////////////

and finally. to where I am STUCK:

What would be the code for the MainRegion to be able to have multiple tabs that do the animation on change? I cannot seem to figure out how to bind anything to AnimatedTabControl or even a regular tab control...

Any help would be appreciated.  I am new to prism...

 

Apr 28, 2011 at 8:56 PM

Hi,

You might find handy the following thread where tab control uses are covered:

How to add new tab(or view) to AnimatedTabControl in StockTraderRI WPF

Additionally, you can read Chapter 7: Composing the User Interface, specifically View Discovery approach section, which is the one you are following to load a view in the tab control.

Also you can check the UI Composition QuickStart and Stock Trader RI where this functionality is implemented.

If you continue experiencing this issue, it could be helpful if you could provide us with a full repro sample of your solution, so that we can help you to identify the cause of your problem.

I hope you find this information useful.

Thanks,

Miguel Bronzovic
http://blogs.southworks.net/mbronzovic

 

Apr 29, 2011 at 2:57 AM

Hi Miguel,

Where should I submit my repo sample.  Should I place the sample in github repo?  Please let me know.  Thanks

John

Apr 29, 2011 at 1:50 PM

Hi John,

You could upload this to SkyDrive, or any other storage site you'd like to, and post the link here.

Thanks,

Miguel Bronzovic
http://blogs.southworks.net/mbronzovic

 

Apr 29, 2011 at 2:42 PM

Hi Miguel,

I posted the complete repo sample in the following github site: "git@github.com:dotcomputercraft/Prism-learning.git"

I know I am missing several items to make the automated tab work.  But I really need some help here because I would love to try it out for a demo project that I am working on.  The basic idea is to have the automatedtab host a view which contains a devExpress grid.  The grid loads data from a database.  After I see how to add 1 item to the tab,  I can hopefully add another tab on my own.   I am thankful for any help you can offer me.  I really like the WPF programing paradigm , but it is a big learning curve.  Talk to you soon.

Regards,

John

Apr 29, 2011 at 5:22 PM

John,

I updated the solution you shared with us and uploaded it to SkyDrive. I removed the DevExpress references and created two new views to add in the animated tabcontrol region.

You can download the updated solution here. I followed the approach described in this thread, the views that are placed inside the AnimatedTabControl have a HeaderInfo property defined inside the View Model, as it is done in the PositionSummaryView of the StockTrader RI.

I hope this helps you resolve your problem.

Miguel Bronzovic
http://blogs.southworks.net/mbronzovic

 

Apr 29, 2011 at 5:34 PM

Miguel,

Thanks for the prompt and excellent support.  Have a wonderful weekend.

Regards,

John