|
|
@ -7,7 +7,6 @@ |
|
|
namespace Perspex.Controls |
|
|
namespace Perspex.Controls |
|
|
{ |
|
|
{ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections; |
|
|
|
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Reactive.Linq; |
|
|
using System.Reactive.Linq; |
|
|
|
|
|
|
|
|
@ -20,7 +19,6 @@ namespace Perspex.Controls |
|
|
|
|
|
|
|
|
public TabControl() |
|
|
public TabControl() |
|
|
{ |
|
|
{ |
|
|
this.GetObservable(ItemsProperty).Subscribe(this.ItemsChanged); |
|
|
|
|
|
this.GetObservable(SelectedItemProperty).Skip(1).Subscribe(this.SelectedItemChanged); |
|
|
this.GetObservable(SelectedItemProperty).Skip(1).Subscribe(this.SelectedItemChanged); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -32,26 +30,18 @@ namespace Perspex.Controls |
|
|
|
|
|
|
|
|
if (this.tabStrip != null) |
|
|
if (this.tabStrip != null) |
|
|
{ |
|
|
{ |
|
|
this.tabStrip.SelectedItem = this.SelectedItem; |
|
|
if (this.IsSet(SelectedItemProperty)) |
|
|
this.tabStrip.GetObservable(TabStrip.SelectedItemProperty).Skip(1).Subscribe(x => |
|
|
{ |
|
|
|
|
|
this.SelectedItem = SelectedItem; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.tabStrip.GetObservable(TabStrip.SelectedItemProperty).Subscribe(x => |
|
|
{ |
|
|
{ |
|
|
this.SelectedItem = x; |
|
|
this.SelectedItem = x; |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void ItemsChanged(IEnumerable items) |
|
|
|
|
|
{ |
|
|
|
|
|
if (items != null) |
|
|
|
|
|
{ |
|
|
|
|
|
this.SelectedItem = items.OfType<object>().FirstOrDefault(); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
this.SelectedItem = null; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void SelectedItemChanged(object item) |
|
|
private void SelectedItemChanged(object item) |
|
|
{ |
|
|
{ |
|
|
this.SelectedItem = item; |
|
|
this.SelectedItem = item; |
|
|
|