Beispiel #1
0
        private void OnSelectedContentChanged(TabbedLayout o, AvaloniaPropertyChangedEventArgs e)
        {
            TabbedLayoutItem oldTabItem = GetTabbedLayoutItem(e.OldValue);

            if (oldTabItem != null)
            {
                oldTabItem.IsSelected = false;
            }

            if (e.NewValue == null)
            {
                return;
            }

            TabbedLayoutItem tabItem = GetTabbedLayoutItem(e.NewValue);

            if (tabItem != null)
            {
                if (tabItem.ClosePropertyTabCommand == null)
                {
                    tabItem.ClosePropertyTabCommand = ClosePropertyTabCommand;
                }

                tabItem.IsSelected = true;
            }
        }
Beispiel #2
0
        private TabbedLayoutItem GetTabbedLayoutItem(object item)
        {
            TabbedLayoutItem tabItem = item as TabbedLayoutItem;

            if (tabItem == null)
            {
                tabItem = (item as IControl)?.Parent as TabbedLayoutItem;
            }
            return(tabItem);
        }