Browse Source

Make TabControl show from XAML.

pull/72/head^2
Steven Kirk 11 years ago
parent
commit
5db655fe87
  1. 3
      Perspex.Controls/ItemsControl.cs
  2. 4
      Perspex.Themes.Default/TabControlStyle.cs

3
Perspex.Controls/ItemsControl.cs

@ -36,7 +36,7 @@ namespace Perspex.Controls
/// Defines the <see cref="Items"/> property. /// Defines the <see cref="Items"/> property.
/// </summary> /// </summary>
public static readonly PerspexProperty<IEnumerable> ItemsProperty = public static readonly PerspexProperty<IEnumerable> ItemsProperty =
PerspexProperty.Register<ItemsControl, IEnumerable>("Items", defaultValue: new Collection<object>()); PerspexProperty.Register<ItemsControl, IEnumerable>("Items");
/// <summary> /// <summary>
/// Defines the <see cref="ItemsPanel"/> property. /// Defines the <see cref="ItemsPanel"/> property.
@ -60,6 +60,7 @@ namespace Perspex.Controls
public ItemsControl() public ItemsControl()
{ {
this.Classes.Add(":empty"); this.Classes.Add(":empty");
this.Items = new PerspexList<object>();
} }
/// <summary> /// <summary>

4
Perspex.Themes.Default/TabControlStyle.cs

@ -43,7 +43,7 @@ namespace Perspex.Themes.Default
new TabStrip new TabStrip
{ {
Name = "tabStrip", Name = "tabStrip",
[~TabStrip.ItemsProperty] = control[~TabControl.ItemsProperty], [!TabStrip.ItemsProperty] = control[!TabControl.ItemsProperty],
[!!TabStrip.SelectedItemProperty] = control[!!TabControl.SelectedItemProperty], [!!TabStrip.SelectedItemProperty] = control[!!TabControl.SelectedItemProperty],
}, },
new Deck new Deck
@ -53,7 +53,7 @@ namespace Perspex.Themes.Default
{ {
new DataTemplate<TabItem>(x => (Control)control.MaterializeDataTemplate(x.Content)), new DataTemplate<TabItem>(x => (Control)control.MaterializeDataTemplate(x.Content)),
}, },
[~Deck.ItemsProperty] = control[~TabControl.ItemsProperty], [!Deck.ItemsProperty] = control[!TabControl.ItemsProperty],
[!Deck.SelectedItemProperty] = control[!TabControl.SelectedItemProperty], [!Deck.SelectedItemProperty] = control[!TabControl.SelectedItemProperty],
[~Deck.TransitionProperty] = control[~TabControl.TransitionProperty], [~Deck.TransitionProperty] = control[~TabControl.TransitionProperty],
[Grid.RowProperty] = 1, [Grid.RowProperty] = 1,

Loading…
Cancel
Save