AnimatedTabControl

Topics: Prism v2 - WPF 3.5
Apr 26, 2010 at 4:33 PM

Hi,

I followed the StockTrader RI to created another applicaion with just one moudle and try to populate the region associated like below

<controls:AnimatedTabControl
                    x:Name="MainRegion"
                    SelectedIndex="0"  
                    VerticalAlignment="Stretch"
                    ItemContainerStyle="{StaticResource ShellTabItemStyle}" 
                    Background="{StaticResource headerBarBG}" 
                    cal:RegionManager.RegionName="{x:Static infrastructure:RegionNames.MainRegion}"
                    AutomationProperties.AutomationId="CPVTab">
                </controls:AnimatedTabControl>

However, the content of the module is not shown when I run the application.

If i just normal tabcontrol, the content of the module will show correctly.

 

Is there anything specialy I missed to configure the AnimatedTabControl?

 

Thanks

Apr 27, 2010 at 8:27 AM
Edited Apr 27, 2010 at 8:28 AM

Hi, from what I can find so far is,

in the StockTraderRI, if we add only one module with views by commented out the others like below in StockTraderRIBootstrapper.cs and the run the application, we can see the POSITION menu. However, the view of POSITION module is not displayed. It seems we have to add at least two modules with views so that the customized AnimatedTabcontrol could work as expected.

Is it designed to work in that way? (Requires at least two mdoules with views?)

protected override IModuleCatalog GetModuleCatalog()
        {
            var catalog = new ModuleCatalog();
            catalog.AddModule(typeof(MarketModule))
                .AddModule(typeof(PositionModule), "MarketModule");
                //.AddModule(typeof(WatchModule), "MarketModule")
                //.AddModule(typeof(NewsModule));

            return catalog;
        }
May 12, 2010 at 5:29 PM

Hi,

Sorry for the delayed response. I have taken a look at the RI code and was able to reproduce the behavior you described. I found that a possible way to get around it was updating the OnSelectionChanged method of the AnimatedTabControl as follows:

 

protected override void OnSelectionChanged(SelectionChangedEventArgs e) 
        { 
            if (e.AddedItems.Count > 0 && e.RemovedItems.Count == 0) 
            { 
                base.OnSelectionChanged(e); 
            } 

            else if (e.RemovedItems.Count > 0) 
            { 
                this.RaiseSelectionChangingEvent(); 

                this.StopTimer(); 
                this.lastArgs = e; 

                this.timer = new DispatcherTimer 
                { 
                    Interval = new TimeSpan(0, 0, 0, 0, 500) 
                }; 

                this.timer.Tick += this.Timer_Tick; 
                this.timer.Start(); 
            } 
        }

Take into account that the AnimatedTabControl  was not thought as a reusable component and that is was specifically designed to be used in the StockTrader RI. In addition, I only tried the workaround in the RI, so it might not work in all scenarios.

Please let me know if this helps.

Damian Schenkelman
http://blogs.southworks.net/dschenkelman