.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Why is tab not focusing properly__

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :WPF

I have a tab control

<TabControl Height="Auto" Grid.Row="1" ItemsSource="{Binding Tabs}" IsSynchronizedWithCurrentItem="True">
That is bound to Tabs in the ViewModel. I also used CollectionViewSource to focus tabs

protected ObservableCollection<TabViewModel> _tabs;
protected ICollectionView _tabsViewSource;

public ObservableCollection<TabViewModel> Tabs
  get { return _tabs; }
public void OnTabsChanged(object sender, NotifyCollectionChangedEventArgs e)
  if (e.NewItems != null && e.NewItems.Count > 0)
    foreach (TabViewModel tab in e.NewItems)
      tab.CloseRequested += OnCloseRequested;
      _tabsViewSource.MoveCurrentTo(tab); // focus newly created tab
  if (e.OldItems != null && e.OldItems.Count > 0)
    foreach (TabViewModel tab in e.OldItems)
      tab.CloseRequested -= OnCloseRequested;
When I have more that 1 tab, when I create new Tabs, tabs are focused properly

when there are no tabs, new tabs don't seem to be focused properly. notice the tab header

how might I fix this? or what is causing this behavior? the text box (tab content) is shown but the header don't r

View Complete Post

More Related Resource Links

Html Editor Focusing with validation


Hello Friends,

In my .aspx page I use Ajax Html editor.... and Currently I need to focus the Editor if the Editor's Content is empty.....

For That I use the following js functions in my Page.....

<script type="text/javascript">
        function pageLoad() {
            if (typeof window.ValidatorGetValue == "function") {
                if (typeof window.ValidatorGetValue_saved != "function") {
                    window.ValidatorGetValue_saved = window.ValidatorGetValue;
                    window.ValidatorGetValue = function (id) {
                        var component = $find(id);
                        if (component != null) {

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend