Browse Source

Renamed Id to Name.

No reason to be different for the sake of it.
pull/58/head
Steven Kirk 11 years ago
parent
commit
ba8552cb81
  1. 2
      Perspex.Controls/Control.cs
  2. 2
      Perspex.Controls/ControlExtensions.cs
  3. 2
      Perspex.Controls/INamed.cs
  4. 2
      Perspex.Controls/Templates/TemplateExtensions.cs
  5. 26
      Perspex.Interactive.UnitTests/InteractiveTests.cs
  6. 2
      Perspex.Styling/IStyleable.cs
  7. 4
      Perspex.Styling/Selectors.cs
  8. 14
      Perspex.Themes.Default/ButtonStyle.cs
  9. 10
      Perspex.Themes.Default/CheckBoxStyle.cs
  10. 2
      Perspex.Themes.Default/ContentControlStyle.cs
  11. 2
      Perspex.Themes.Default/DeckStyle.cs
  12. 8
      Perspex.Themes.Default/DropDownStyle.cs
  13. 2
      Perspex.Themes.Default/ItemsControlStyle.cs
  14. 4
      Perspex.Themes.Default/ListBoxItemStyle.cs
  15. 2
      Perspex.Themes.Default/ListBoxStyle.cs
  16. 2
      Perspex.Themes.Default/PopupRootStyle.cs
  17. 10
      Perspex.Themes.Default/RadioButtonStyle.cs
  18. 8
      Perspex.Themes.Default/ScrollBarStyle.cs
  19. 6
      Perspex.Themes.Default/ScrollViewerStyle.cs
  20. 4
      Perspex.Themes.Default/TabControlStyle.cs
  21. 2
      Perspex.Themes.Default/TabItemStyle.cs
  22. 2
      Perspex.Themes.Default/TabStripStyle.cs
  23. 6
      Perspex.Themes.Default/TextBoxStyle.cs
  24. 16
      Perspex.Themes.Default/ToggleButtonStyle.cs
  25. 8
      Perspex.Themes.Default/TreeViewItemStyle.cs
  26. 2
      Perspex.Themes.Default/TreeViewStyle.cs
  27. 2
      Perspex.Themes.Default/WindowStyle.cs
  28. 2
      TestApplication/Program.cs
  29. 10
      Tests/Perspex.Controls.UnitTests/ContentControlTests.cs
  30. 2
      Tests/Perspex.Controls.UnitTests/DeckTests.cs
  31. 10
      Tests/Perspex.Controls.UnitTests/DropDownTests.cs
  32. 2
      Tests/Perspex.Controls.UnitTests/ItemsControlTests.cs
  33. 2
      Tests/Perspex.Controls.UnitTests/ListBoxTests.cs
  34. 2
      Tests/Perspex.Controls.UnitTests/Primitives/SelectingItemsControlTests.cs
  35. 10
      Tests/Perspex.Controls.UnitTests/ScrollViewerTests.cs
  36. 24
      Tests/Perspex.Controls.UnitTests/TabControlTests.cs
  37. 14
      Tests/Perspex.Controls.UnitTests/TabStripTests.cs
  38. 14
      Tests/Perspex.Controls.UnitTests/Templates/TemplateExtensionsTests.cs
  39. 246
      Tests/Perspex.Input.UnitTests/KeyboardNavigationTests.cs
  40. 2
      Tests/Perspex.Styling.UnitTests/SelectorTests_Descendent.cs
  41. 24
      Tests/Perspex.Styling.UnitTests/SelectorTests_Id.cs
  42. 4
      Tests/Perspex.Styling.UnitTests/SelectorTests_Multiple.cs
  43. 2
      Tests/Perspex.Styling.UnitTests/TestControlBase.cs
  44. 2
      Tests/Perspex.Styling.UnitTests/TestTemplatedControl.cs

2
Perspex.Controls/Control.cs

@ -101,7 +101,7 @@ namespace Perspex.Controls
}
}
public string Id
public string Name
{
get
{

2
Perspex.Controls/ControlExtensions.cs

@ -21,7 +21,7 @@ namespace Perspex.Controls
{
return control.GetLogicalDescendents()
.OfType<T>()
.FirstOrDefault(x => x.Id == id);
.FirstOrDefault(x => x.Name == id);
}
}
}

2
Perspex.Controls/INamed.cs

@ -8,6 +8,6 @@ namespace Perspex.Controls
{
public interface INamed
{
string Id { get; }
string Name { get; }
}
}

2
Perspex.Controls/Templates/TemplateExtensions.cs

@ -17,7 +17,7 @@ namespace Perspex.Controls.Templates
{
public static T FindTemplateChild<T>(this ITemplatedControl control, string id) where T : INamed
{
return control.GetTemplateChildren().OfType<T>().SingleOrDefault(x => x.Id == id);
return control.GetTemplateChildren().OfType<T>().SingleOrDefault(x => x.Name == id);
}
public static T GetTemplateChild<T>(this ITemplatedControl control, string id) where T : INamed

26
Perspex.Interactive.UnitTests/InteractiveTests.cs

@ -21,7 +21,7 @@ namespace Perspex.Interactive.UnitTests
{
var ev = new RoutedEvent("test", RoutingStrategies.Direct, typeof(RoutedEventArgs), typeof(TestInteractive));
var invoked = new List<string>();
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Id);
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Name);
var target = this.CreateTree(ev, handler, RoutingStrategies.Direct);
var args = new RoutedEventArgs(ev, target);
@ -55,7 +55,7 @@ namespace Perspex.Interactive.UnitTests
{
var ev = new RoutedEvent("test", RoutingStrategies.Bubble, typeof(RoutedEventArgs), typeof(TestInteractive));
var invoked = new List<string>();
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Id);
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Name);
var target = this.CreateTree(ev, handler, RoutingStrategies.Bubble | RoutingStrategies.Tunnel);
var args = new RoutedEventArgs(ev, target);
@ -69,7 +69,7 @@ namespace Perspex.Interactive.UnitTests
{
var ev = new RoutedEvent("test", RoutingStrategies.Tunnel, typeof(RoutedEventArgs), typeof(TestInteractive));
var invoked = new List<string>();
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Id);
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Name);
var target = this.CreateTree(ev, handler, RoutingStrategies.Bubble | RoutingStrategies.Tunnel);
var args = new RoutedEventArgs(ev, target);
@ -87,7 +87,7 @@ namespace Perspex.Interactive.UnitTests
typeof(RoutedEventArgs),
typeof(TestInteractive));
var invoked = new List<string>();
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Id);
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Name);
var target = this.CreateTree(ev, handler, RoutingStrategies.Bubble | RoutingStrategies.Tunnel);
var args = new RoutedEventArgs(ev, target);
@ -204,7 +204,7 @@ namespace Perspex.Interactive.UnitTests
EventHandler<RoutedEventArgs> handler = (s, e) =>
{
invoked.Add(((TestInteractive)s).Id);
invoked.Add(((TestInteractive)s).Name);
e.Handled = true;
};
@ -225,7 +225,7 @@ namespace Perspex.Interactive.UnitTests
typeof(RoutedEventArgs),
typeof(TestInteractive));
var invoked = new List<string>();
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Id);
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Name);
var target = this.CreateTree(ev, null, 0);
@ -246,7 +246,7 @@ namespace Perspex.Interactive.UnitTests
typeof(RoutedEventArgs),
typeof(TestInteractive));
var invoked = new List<string>();
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Id);
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Name);
var target = this.CreateTree(ev, null, 0);
@ -267,7 +267,7 @@ namespace Perspex.Interactive.UnitTests
typeof(RoutedEventArgs),
typeof(TestInteractive));
var invoked = new List<string>();
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Id);
EventHandler<RoutedEventArgs> handler = (s, e) => invoked.Add(((TestInteractive)s).Name);
var target = this.CreateTree(ev, null, 0);
@ -308,21 +308,21 @@ namespace Perspex.Interactive.UnitTests
var tree = new TestInteractive
{
Id = "1",
Name = "1",
Children = new[]
{
new TestInteractive
{
Id = "2a",
Name = "2a",
},
(target = new TestInteractive
{
Id = "2b",
Name = "2b",
Children = new[]
{
new TestInteractive
{
Id = "3",
Name = "3",
},
},
}),
@ -342,7 +342,7 @@ namespace Perspex.Interactive.UnitTests
private class TestInteractive : Interactive
{
public string Id { get; set; }
public string Name { get; set; }
public bool ClassHandlerInvoked { get; private set; }

2
Perspex.Styling/IStyleable.cs

@ -21,7 +21,7 @@ namespace Perspex.Styling
/// <summary>
/// Gets the ID of the control.
/// </summary>
string Id { get; }
string Name { get; }
/// <summary>
/// Gets the type by which the control is styled.

4
Perspex.Styling/Selectors.cs

@ -53,13 +53,13 @@ namespace Perspex.Styling
};
}
public static Selector Id(this Selector previous, string id)
public static Selector Name(this Selector previous, string id)
{
Contract.Requires<ArgumentNullException>(previous != null);
return new Selector(previous)
{
GetObservable = control => Observable.Return(control.Id == id),
GetObservable = control => Observable.Return(control.Name == id),
SelectorString = '#' + id,
};
}

14
Perspex.Themes.Default/ButtonStyle.cs

@ -31,7 +31,7 @@ namespace Perspex.Themes.Default
new Setter(Button.VerticalContentAlignmentProperty, VerticalAlignment.Center),
},
},
new Style(x => x.OfType<Button>().Template().Id("border"))
new Style(x => x.OfType<Button>().Template().Name("border"))
{
Setters = new[]
{
@ -41,7 +41,7 @@ namespace Perspex.Themes.Default
new Setter(Button.ForegroundProperty, new SolidColorBrush(0xff000000)),
},
},
new Style(x => x.OfType<Button>().Class(":pointerover").Template().Id("border"))
new Style(x => x.OfType<Button>().Class(":pointerover").Template().Name("border"))
{
Setters = new[]
{
@ -49,21 +49,21 @@ namespace Perspex.Themes.Default
new Setter(Button.BorderBrushProperty, new SolidColorBrush(0xff3c7fb1)),
},
},
new Style(x => x.OfType<Button>().Class(":pointerover").Class(":pressed").Template().Id("border"))
new Style(x => x.OfType<Button>().Class(":pointerover").Class(":pressed").Template().Name("border"))
{
Setters = new[]
{
new Setter(Button.BackgroundProperty, new SolidColorBrush(0xffc4e5f6)),
},
},
new Style(x => x.OfType<Button>().Class(":pressed").Template().Id("border"))
new Style(x => x.OfType<Button>().Class(":pressed").Template().Name("border"))
{
Setters = new[]
{
new Setter(Button.BorderBrushProperty, new SolidColorBrush(0xffff628b)),
},
},
new Style(x => x.OfType<Button>().Class(":disabled").Template().Id("border"))
new Style(x => x.OfType<Button>().Class(":disabled").Template().Name("border"))
{
Setters = new[]
{
@ -88,11 +88,11 @@ namespace Perspex.Themes.Default
{
Border border = new Border
{
Id = "border",
Name = "border",
Padding = new Thickness(3),
Content = new ContentPresenter
{
Id = "contentPresenter",
Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = control[~Button.ContentProperty],
[~ContentPresenter.HorizontalAlignmentProperty] = control[~Button.HorizontalContentAlignmentProperty],
[~ContentPresenter.VerticalAlignmentProperty] = control[~Button.VerticalContentAlignmentProperty],

10
Perspex.Themes.Default/CheckBoxStyle.cs

@ -28,14 +28,14 @@ namespace Perspex.Themes.Default
new Setter(Button.TemplateProperty, ControlTemplate.Create<CheckBox>(this.Template)),
},
},
new Style(x => x.OfType<CheckBox>().Template().Id("checkMark"))
new Style(x => x.OfType<CheckBox>().Template().Name("checkMark"))
{
Setters = new[]
{
new Setter(Shape.IsVisibleProperty, false),
},
},
new Style(x => x.OfType<CheckBox>().Class(":checked").Template().Id("checkMark"))
new Style(x => x.OfType<CheckBox>().Class(":checked").Template().Name("checkMark"))
{
Setters = new[]
{
@ -61,7 +61,7 @@ namespace Perspex.Themes.Default
{
new Border
{
Id = "checkBorder",
Name = "checkBorder",
BorderBrush = Brushes.Black,
BorderThickness = 2,
Width = 18,
@ -71,7 +71,7 @@ namespace Perspex.Themes.Default
},
new Path
{
Id = "checkMark",
Name = "checkMark",
Fill = Brushes.Black,
Width = 11,
Height = 10,
@ -83,7 +83,7 @@ namespace Perspex.Themes.Default
},
new ContentPresenter
{
Id = "contentPresenter",
Name = "contentPresenter",
Margin = new Thickness(4, 0, 0, 0),
VerticalAlignment = VerticalAlignment.Center,
[~ContentPresenter.ContentProperty] = control[~CheckBox.ContentProperty],

2
Perspex.Themes.Default/ContentControlStyle.cs

@ -32,7 +32,7 @@ namespace Perspex.Themes.Default
{
return new ContentPresenter
{
Id = "contentPresenter",
Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = control[~ContentControl.ContentProperty],
};
}

2
Perspex.Themes.Default/DeckStyle.cs

@ -31,7 +31,7 @@ namespace Perspex.Themes.Default
{
return new DeckPresenter
{
Id = "itemsPresenter",
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = control[~Deck.ItemsProperty],
[~ItemsPresenter.ItemsPanelProperty] = control[~Deck.ItemsPanelProperty],
[~DeckPresenter.SelectedItemProperty] = control[~Deck.SelectedItemProperty],

8
Perspex.Themes.Default/DropDownStyle.cs

@ -52,7 +52,7 @@ namespace Perspex.Themes.Default
[~Border.BorderThicknessProperty] = control[~DropDown.BorderThicknessProperty],
Content = new Grid
{
Id = "container",
Name = "container",
ColumnDefinitions = new ColumnDefinitions
{
new ColumnDefinition(new GridLength(1, GridUnitType.Star)),
@ -62,7 +62,7 @@ namespace Perspex.Themes.Default
{
new ContentControl
{
Id = "contentControl",
Name = "contentControl",
Margin = new Thickness(3),
[~ContentControl.ContentProperty] = control[~DropDown.ContentProperty],
[~ContentControl.HorizontalAlignmentProperty] = control[~DropDown.HorizontalContentAlignmentProperty],
@ -70,13 +70,13 @@ namespace Perspex.Themes.Default
},
new ToggleButton
{
Id = "toggle",
Name = "toggle",
BorderThickness = 0,
Background = Brushes.Transparent,
ClickMode = ClickMode.Press,
Content = new Path
{
Id = "checkMark",
Name = "checkMark",
Fill = Brushes.Black,
Width = 8,
Height = 4,

2
Perspex.Themes.Default/ItemsControlStyle.cs

@ -31,7 +31,7 @@ namespace Perspex.Themes.Default
{
return new ItemsPresenter
{
Id = "itemsPresenter",
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty],
[~ItemsPresenter.ItemsPanelProperty] = control[~ItemsControl.ItemsPanelProperty],
};

4
Perspex.Themes.Default/ListBoxItemStyle.cs

@ -25,7 +25,7 @@ namespace Perspex.Themes.Default
new Setter(ListBoxItem.TemplateProperty, ControlTemplate.Create<ListBoxItem>(this.Template)),
},
},
new Style(x => x.OfType<ListBoxItem>().Class(":selected").Template().Id("border"))
new Style(x => x.OfType<ListBoxItem>().Class(":selected").Template().Name("border"))
{
Setters = new[]
{
@ -40,7 +40,7 @@ namespace Perspex.Themes.Default
{
return new Border
{
Id = "border",
Name = "border",
[~Border.BackgroundProperty] = control[~ListBoxItem.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~ListBoxItem.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~ListBoxItem.BorderThicknessProperty],

2
Perspex.Themes.Default/ListBoxStyle.cs

@ -42,7 +42,7 @@ namespace Perspex.Themes.Default
{
Content = new ItemsPresenter
{
Id = "itemsPresenter",
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = control[~ListBox.ItemsProperty],
[~ItemsPresenter.ItemsPanelProperty] = control[~ListBox.ItemsPanelProperty],
}

2
Perspex.Themes.Default/PopupRootStyle.cs

@ -37,7 +37,7 @@ namespace Perspex.Themes.Default
[~Border.BackgroundProperty] = control[~PopupRoot.BackgroundProperty],
Content = new ContentPresenter
{
Id = "contentPresenter",
Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = control[~PopupRoot.ContentProperty],
}
};

10
Perspex.Themes.Default/RadioButtonStyle.cs

@ -28,14 +28,14 @@ namespace Perspex.Themes.Default
new Setter(Button.TemplateProperty, ControlTemplate.Create<RadioButton>(this.Template)),
},
},
new Style(x => x.OfType<RadioButton>().Template().Id("checkMark"))
new Style(x => x.OfType<RadioButton>().Template().Name("checkMark"))
{
Setters = new[]
{
new Setter(Shape.IsVisibleProperty, false),
},
},
new Style(x => x.OfType<RadioButton>().Class(":checked").Template().Id("checkMark"))
new Style(x => x.OfType<RadioButton>().Class(":checked").Template().Name("checkMark"))
{
Setters = new[]
{
@ -61,7 +61,7 @@ namespace Perspex.Themes.Default
{
new Ellipse
{
Id = "checkBorder",
Name = "checkBorder",
Stroke = Brushes.Black,
StrokeThickness = 2,
Width = 18,
@ -71,7 +71,7 @@ namespace Perspex.Themes.Default
},
new Ellipse
{
Id = "checkMark",
Name = "checkMark",
Fill = Brushes.Black,
Width = 10,
Height = 10,
@ -82,7 +82,7 @@ namespace Perspex.Themes.Default
},
new ContentPresenter
{
Id = "contentPresenter",
Name = "contentPresenter",
Margin = new Thickness(4, 0, 0, 0),
VerticalAlignment = VerticalAlignment.Center,
[~ContentPresenter.ContentProperty] = control[~RadioButton.ContentProperty],

8
Perspex.Themes.Default/ScrollBarStyle.cs

@ -34,7 +34,7 @@ namespace Perspex.Themes.Default
new Setter(ScrollBar.HeightProperty, 10.0),
},
},
new Style(x => x.OfType<ScrollBar>().Class(":horizontal").Template().Id("thumb"))
new Style(x => x.OfType<ScrollBar>().Class(":horizontal").Template().Name("thumb"))
{
Setters = new[]
{
@ -49,7 +49,7 @@ namespace Perspex.Themes.Default
new Setter(ScrollBar.WidthProperty, 10.0),
},
},
new Style(x => x.OfType<ScrollBar>().Class(":vertical").Template().Id("thumb"))
new Style(x => x.OfType<ScrollBar>().Class(":vertical").Template().Name("thumb"))
{
Setters = new[]
{
@ -66,14 +66,14 @@ namespace Perspex.Themes.Default
Background = Brushes.Silver,
Content = new Track
{
Id = "track",
Name = "track",
[~Track.MinimumProperty] = control[~ScrollBar.MinimumProperty],
[~Track.MaximumProperty] = control[~ScrollBar.MaximumProperty],
[~Track.ViewportSizeProperty] = control[~ScrollBar.ViewportSizeProperty],
[~Track.OrientationProperty] = control[~ScrollBar.OrientationProperty],
Thumb = new Thumb
{
Id = "thumb",
Name = "thumb",
Template = ControlTemplate.Create<Thumb>(this.ThumbTemplate),
},
},

6
Perspex.Themes.Default/ScrollViewerStyle.cs

@ -47,7 +47,7 @@ namespace Perspex.Themes.Default
{
new ScrollContentPresenter
{
Id = "contentPresenter",
Name = "contentPresenter",
[~ScrollContentPresenter.ContentProperty] = control[~ScrollViewer.ContentProperty],
[~~ScrollContentPresenter.ExtentProperty] = control[~~ScrollViewer.ExtentProperty],
[~~ScrollContentPresenter.OffsetProperty] = control[~~ScrollViewer.OffsetProperty],
@ -56,7 +56,7 @@ namespace Perspex.Themes.Default
},
new ScrollBar
{
Id = "horizontalScrollBar",
Name = "horizontalScrollBar",
Orientation = Orientation.Horizontal,
[~ScrollBar.MaximumProperty] = control[~ScrollViewer.HorizontalScrollBarMaximumProperty],
[~~ScrollBar.ValueProperty] = control[~~ScrollViewer.HorizontalScrollBarValueProperty],
@ -66,7 +66,7 @@ namespace Perspex.Themes.Default
},
new ScrollBar
{
Id = "verticalScrollBar",
Name = "verticalScrollBar",
Orientation = Orientation.Vertical,
[~ScrollBar.MaximumProperty] = control[~ScrollViewer.VerticalScrollBarMaximumProperty],
[~~ScrollBar.ValueProperty] = control[~~ScrollViewer.VerticalScrollBarValueProperty],

4
Perspex.Themes.Default/TabControlStyle.cs

@ -45,13 +45,13 @@ namespace Perspex.Themes.Default
{
new TabStrip
{
Id = "tabStrip",
Name = "tabStrip",
[~TabStrip.ItemsProperty] = control[~TabControl.ItemsProperty],
[~~TabStrip.SelectedItemProperty] = control[~~TabControl.SelectedItemProperty],
},
new Deck
{
Id = "deck",
Name = "deck",
DataTemplates = new DataTemplates
{
new DataTemplate<TabItem>(x => control.MaterializeDataTemplate(x.Content)),

2
Perspex.Themes.Default/TabItemStyle.cs

@ -41,7 +41,7 @@ namespace Perspex.Themes.Default
{
return new ContentPresenter
{
Id = "headerPresenter",
Name = "headerPresenter",
[~ContentPresenter.ContentProperty] = control[~TabItem.HeaderProperty],
};
}

2
Perspex.Themes.Default/TabStripStyle.cs

@ -40,7 +40,7 @@ namespace Perspex.Themes.Default
{
return new ItemsPresenter
{
Id = "itemsPresenter",
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = control[~ItemsControl.ItemsProperty],
[~ItemsPresenter.ItemsPanelProperty] = control[~ItemsControl.ItemsPanelProperty],
};

6
Perspex.Themes.Default/TextBoxStyle.cs

@ -30,7 +30,7 @@ namespace Perspex.Themes.Default
new Setter(TextBox.FocusAdornerProperty, null),
},
},
new Style(x => x.OfType<TextBox>().Class(":focus").Template().Id("border"))
new Style(x => x.OfType<TextBox>().Class(":focus").Template().Name("border"))
{
Setters = new[]
{
@ -44,7 +44,7 @@ namespace Perspex.Themes.Default
{
Border result = new Border
{
Id = "border",
Name = "border",
Padding = new Thickness(2),
[~Border.BackgroundProperty] = control[~TextBox.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~TextBox.BorderBrushProperty],
@ -56,7 +56,7 @@ namespace Perspex.Themes.Default
[~ScrollViewer.VerticalScrollBarVisibilityProperty] = control[~ScrollViewer.VerticalScrollBarVisibilityProperty],
Content = new TextPresenter
{
Id = "textPresenter",
Name = "textPresenter",
[~TextPresenter.CaretIndexProperty] = control[~TextBox.CaretIndexProperty],
[~TextPresenter.SelectionStartProperty] = control[~TextBox.SelectionStartProperty],
[~TextPresenter.SelectionEndProperty] = control[~TextBox.SelectionEndProperty],

16
Perspex.Themes.Default/ToggleButtonStyle.cs

@ -34,14 +34,14 @@ namespace Perspex.Themes.Default
new Setter(ToggleButton.VerticalContentAlignmentProperty, VerticalAlignment.Center),
},
},
new Style(x => x.OfType<ToggleButton>().Class(":checked").Template().Id("border"))
new Style(x => x.OfType<ToggleButton>().Class(":checked").Template().Name("border"))
{
Setters = new[]
{
new Setter(ToggleButton.BackgroundProperty, new SolidColorBrush(0xff7f7f7f)),
},
},
new Style(x => x.OfType<ToggleButton>().Class(":pointerover").Template().Id("border"))
new Style(x => x.OfType<ToggleButton>().Class(":pointerover").Template().Name("border"))
{
Setters = new[]
{
@ -49,28 +49,28 @@ namespace Perspex.Themes.Default
new Setter(ToggleButton.BorderBrushProperty, new SolidColorBrush(0xff3c7fb1)),
},
},
new Style(x => x.OfType<ToggleButton>().Class(":checked").Class(":pointerover").Template().Id("border"))
new Style(x => x.OfType<ToggleButton>().Class(":checked").Class(":pointerover").Template().Name("border"))
{
Setters = new[]
{
new Setter(ToggleButton.BackgroundProperty, new SolidColorBrush(0xffa0a0a0)),
},
},
new Style(x => x.OfType<ToggleButton>().Class(":pointerover").Class(":pressed").Template().Id("border"))
new Style(x => x.OfType<ToggleButton>().Class(":pointerover").Class(":pressed").Template().Name("border"))
{
Setters = new[]
{
new Setter(ToggleButton.BackgroundProperty, new SolidColorBrush(0xffc4e5f6)),
},
},
new Style(x => x.OfType<ToggleButton>().Class(":pressed").Template().Id("border"))
new Style(x => x.OfType<ToggleButton>().Class(":pressed").Template().Name("border"))
{
Setters = new[]
{
new Setter(ToggleButton.BorderBrushProperty, new SolidColorBrush(0xffff628b)),
},
},
new Style(x => x.OfType<ToggleButton>().Class(":disabled").Template().Id("border"))
new Style(x => x.OfType<ToggleButton>().Class(":disabled").Template().Name("border"))
{
Setters = new[]
{
@ -84,14 +84,14 @@ namespace Perspex.Themes.Default
{
Border border = new Border
{
Id = "border",
Name = "border",
Padding = new Thickness(3),
[~Border.BackgroundProperty] = control[~ToggleButton.BackgroundProperty],
[~Border.BorderBrushProperty] = control[~ToggleButton.BorderBrushProperty],
[~Border.BorderThicknessProperty] = control[~ToggleButton.BorderThicknessProperty],
Content = new ContentPresenter
{
Id = "contentPresenter",
Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = control[~ToggleButton.ContentProperty],
[~ContentPresenter.HorizontalAlignmentProperty] = control[~ToggleButton.HorizontalContentAlignmentProperty],
[~ContentPresenter.VerticalAlignmentProperty] = control[~ToggleButton.VerticalContentAlignmentProperty],

8
Perspex.Themes.Default/TreeViewItemStyle.cs

@ -28,14 +28,14 @@ namespace Perspex.Themes.Default
new Setter(Button.TemplateProperty, ControlTemplate.Create<TreeViewItem>(this.Template)),
},
},
new Style(x => x.OfType<TreeViewItem>().Template().Id("header"))
new Style(x => x.OfType<TreeViewItem>().Template().Name("header"))
{
Setters = new[]
{
new Setter(Border.PaddingProperty, new Thickness(2)),
},
},
new Style(x => x.OfType<TreeViewItem>().Class(":selected").Template().Id("header"))
new Style(x => x.OfType<TreeViewItem>().Class(":selected").Template().Name("header"))
{
Setters = new[]
{
@ -89,7 +89,7 @@ namespace Perspex.Themes.Default
},
new Border
{
Id = "header",
Name = "header",
[~Border.BackgroundProperty] = control[~TreeViewItem.BackgroundProperty],
[Grid.ColumnProperty] = 1,
Content = new ContentPresenter
@ -101,7 +101,7 @@ namespace Perspex.Themes.Default
},
new ItemsPresenter
{
Id = "itemsPresenter",
Name = "itemsPresenter",
Margin = new Thickness(24, 0, 0, 0),
[~ItemsPresenter.ItemsProperty] = control[~TreeViewItem.ItemsProperty],
[~ItemsPresenter.ItemsPanelProperty] = control[~TreeViewItem.ItemsPanelProperty],

2
Perspex.Themes.Default/TreeViewStyle.cs

@ -43,7 +43,7 @@ namespace Perspex.Themes.Default
CanScrollHorizontally = true,
Content = new ItemsPresenter
{
Id = "itemsPresenter",
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = control[~TreeView.ItemsProperty],
[~ItemsPresenter.ItemsPanelProperty] = control[~TreeView.ItemsPanelProperty],
}

2
Perspex.Themes.Default/WindowStyle.cs

@ -40,7 +40,7 @@ namespace Perspex.Themes.Default
{
Content = new ContentPresenter
{
Id = "contentPresenter",
Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = control[~Window.ContentProperty],
}
}

2
TestApplication/Program.cs

@ -412,7 +412,7 @@ namespace TestApplication
{
new TreeView
{
Id = "treeView",
Name = "treeView",
Items = treeData,
},
(listBox = new ListBox

10
Tests/Perspex.Controls.UnitTests/ContentControlTests.cs

@ -160,7 +160,7 @@ namespace Perspex.Controls.UnitTests
target.Content = null;
// Need to call ApplyTemplate on presenter for LogocalChildren to be updated.
var presenter = target.GetTemplateChildren().Single(x => x.Id == "contentPresenter");
var presenter = target.GetTemplateChildren().Single(x => x.Name == "contentPresenter");
presenter.ApplyTemplate();
Assert.Equal(new ILogical[0], ((ILogical)target).LogicalChildren.ToList());
@ -181,7 +181,7 @@ namespace Perspex.Controls.UnitTests
contentControl.ApplyTemplate();
// Need to call ApplyTemplate on presenter for CollectionChanged to be called.
var presenter = contentControl.GetTemplateChildren().Single(x => x.Id == "contentPresenter");
var presenter = contentControl.GetTemplateChildren().Single(x => x.Name == "contentPresenter");
presenter.ApplyTemplate();
Assert.True(called);
@ -204,7 +204,7 @@ namespace Perspex.Controls.UnitTests
contentControl.Content = null;
// Need to call ApplyTemplate on presenter for CollectionChanged to be called.
var presenter = contentControl.GetTemplateChildren().Single(x => x.Id == "contentPresenter");
var presenter = contentControl.GetTemplateChildren().Single(x => x.Name == "contentPresenter");
presenter.ApplyTemplate();
Assert.True(called);
@ -228,7 +228,7 @@ namespace Perspex.Controls.UnitTests
contentControl.Content = child2;
// Need to call ApplyTemplate on presenter for CollectionChanged to be called.
var presenter = contentControl.GetTemplateChildren().Single(x => x.Id == "contentPresenter");
var presenter = contentControl.GetTemplateChildren().Single(x => x.Name == "contentPresenter");
presenter.ApplyTemplate();
Assert.True(called);
@ -243,7 +243,7 @@ namespace Perspex.Controls.UnitTests
Background = new Perspex.Media.SolidColorBrush(0xffffffff),
Content = new ContentPresenter
{
Id = "contentPresenter",
Name = "contentPresenter",
[~ContentPresenter.ContentProperty] = parent[~ContentControl.ContentProperty],
}
};

2
Tests/Perspex.Controls.UnitTests/DeckTests.cs

@ -57,7 +57,7 @@ namespace Perspex.Controls.UnitTests
{
return new DeckPresenter
{
Id = "itemsPresenter",
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = control[~Deck.ItemsProperty],
[~ItemsPresenter.ItemsPanelProperty] = control[~Deck.ItemsPanelProperty],
[~DeckPresenter.SelectedItemProperty] = control[~Deck.SelectedItemProperty],

10
Tests/Perspex.Controls.UnitTests/DropDownTests.cs

@ -32,7 +32,7 @@ namespace Perspex.Controls.UnitTests
target.Template = this.GetTemplate();
target.ApplyTemplate();
var childIds = ((ILogical)target).LogicalChildren.Cast<Control>().Select(x => x.Id);
var childIds = ((ILogical)target).LogicalChildren.Cast<Control>().Select(x => x.Name);
Assert.Equal(new[] { "contentControl", "toggle", "popup" }, childIds);
}
@ -43,21 +43,21 @@ namespace Perspex.Controls.UnitTests
{
return new Panel
{
Id = "container",
Name = "container",
Children = new Controls
{
new ContentControl
{
Id = "contentControl",
Name = "contentControl",
[~ContentPresenter.ContentProperty] = parent[~DropDown.ContentProperty],
},
new ToggleButton
{
Id = "toggle",
Name = "toggle",
},
new Popup
{
Id = "popup",
Name = "popup",
}
}
};

2
Tests/Perspex.Controls.UnitTests/ItemsControlTests.cs

@ -284,7 +284,7 @@ namespace Perspex.Controls.UnitTests
Background = new Perspex.Media.SolidColorBrush(0xffffffff),
Content = new ItemsPresenter
{
Id = "itemsPresenter",
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = parent[~ItemsControl.ItemsProperty],
}
};

2
Tests/Perspex.Controls.UnitTests/ListBoxTests.cs

@ -42,7 +42,7 @@ namespace Perspex.Controls.UnitTests
Template = new ControlTemplate(this.CreateScrollViewerTemplate),
Content = new ItemsPresenter
{
Id = "itemsPresenter",
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = parent.GetObservable(ListBox.ItemsProperty),
}
};

2
Tests/Perspex.Controls.UnitTests/Primitives/SelectingItemsControlTests.cs

@ -288,7 +288,7 @@ namespace Perspex.Controls.Primitives.UnitTests
return ControlTemplate.Create<Target>(control =>
new ItemsPresenter
{
Id = "itemsPresenter",
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = control[~ListBox.ItemsProperty],
[~ItemsPresenter.ItemsPanelProperty] = control[~ListBox.ItemsPanelProperty],
});

10
Tests/Perspex.Controls.UnitTests/ScrollViewerTests.cs

@ -46,7 +46,7 @@ namespace Perspex.Controls.UnitTests
var presenter = target.GetVisualDescendents()
.OfType<ContentPresenter>()
.Single(x => x.Id == "this");
.Single(x => x.Name == "this");
Assert.Equal(target, presenter.TemplatedParent);
}
@ -69,7 +69,7 @@ namespace Perspex.Controls.UnitTests
{
new ScrollContentPresenter
{
Id = "contentPresenter",
Name = "contentPresenter",
[~ScrollContentPresenter.ContentProperty] = control[~ScrollViewer.ContentProperty],
[~~ScrollContentPresenter.ExtentProperty] = control[~~ScrollViewer.ExtentProperty],
[~~ScrollContentPresenter.OffsetProperty] = control[~~ScrollViewer.OffsetProperty],
@ -78,7 +78,7 @@ namespace Perspex.Controls.UnitTests
},
new ScrollBar
{
Id = "horizontalScrollBar",
Name = "horizontalScrollBar",
Orientation = Orientation.Horizontal,
[~ScrollBar.MaximumProperty] = control[~ScrollViewer.HorizontalScrollBarMaximumProperty],
[~~ScrollBar.ValueProperty] = control[~~ScrollViewer.HorizontalScrollBarValueProperty],
@ -88,7 +88,7 @@ namespace Perspex.Controls.UnitTests
},
new ScrollBar
{
Id = "verticalScrollBar",
Name = "verticalScrollBar",
Orientation = Orientation.Vertical,
[~ScrollBar.MaximumProperty] = control[~ScrollViewer.VerticalScrollBarMaximumProperty],
[~~ScrollBar.ValueProperty] = control[~~ScrollViewer.VerticalScrollBarValueProperty],
@ -107,7 +107,7 @@ namespace Perspex.Controls.UnitTests
Template = ControlTemplate.Create<ScrollViewer>(this.CreateTemplate),
Content = new ContentPresenter
{
Id = "this"
Name = "this"
}
};
}

24
Tests/Perspex.Controls.UnitTests/TabControlTests.cs

@ -25,11 +25,11 @@ namespace Perspex.Controls.UnitTests
{
new TabItem
{
Id = "first"
Name = "first"
},
new TabItem
{
Id = "second"
Name = "second"
},
}
};
@ -74,11 +74,11 @@ namespace Perspex.Controls.UnitTests
{
new TabItem
{
Id = "first"
Name = "first"
},
new TabItem
{
Id = "second"
Name = "second"
},
}
};
@ -99,11 +99,11 @@ namespace Perspex.Controls.UnitTests
{
new TabItem
{
Id = "first"
Name = "first"
},
new TabItem
{
Id = "second"
Name = "second"
},
}
};
@ -124,11 +124,11 @@ namespace Perspex.Controls.UnitTests
{
new TabItem
{
Content = new TextBlock { Id = "Foo" }
Content = new TextBlock { Name = "Foo" }
},
new TabItem
{
Content = new TextBlock { Id = "Foo" }
Content = new TextBlock { Name = "Foo" }
},
},
};
@ -136,7 +136,7 @@ namespace Perspex.Controls.UnitTests
target.ApplyTemplate();
Assert.Equal(1, target.GetLogicalChildren().Count());
Assert.Equal("Foo", ((TextBlock)target.GetLogicalChildren().First()).Id);
Assert.Equal("Foo", ((TextBlock)target.GetLogicalChildren().First()).Name);
}
private Control CreateTabControlTemplate(TabControl parent)
@ -147,14 +147,14 @@ namespace Perspex.Controls.UnitTests
{
new TabStrip
{
Id = "tabStrip",
Name = "tabStrip",
Template = ControlTemplate.Create<TabStrip>(this.CreateTabStripTemplate),
[~TabStrip.ItemsProperty] = parent[~TabControl.ItemsProperty],
[~~TabStrip.SelectedTabProperty] = parent[~~TabControl.SelectedTabProperty]
},
new Deck
{
Id = "deck",
Name = "deck",
[~Deck.ItemsProperty] = parent[~TabControl.ItemsProperty],
[!Deck.SelectedItemProperty] = parent[!TabControl.SelectedItemProperty],
}
@ -166,7 +166,7 @@ namespace Perspex.Controls.UnitTests
{
return new ItemsPresenter
{
Id = "itemsPresenter",
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = parent[~TabStrip.ItemsProperty],
};
}

14
Tests/Perspex.Controls.UnitTests/TabStripTests.cs

@ -25,11 +25,11 @@ namespace Perspex.Controls.UnitTests
{
new TabItem
{
Id = "first"
Name = "first"
},
new TabItem
{
Id = "second"
Name = "second"
},
}
};
@ -50,11 +50,11 @@ namespace Perspex.Controls.UnitTests
{
new TabItem
{
Id = "first"
Name = "first"
},
new TabItem
{
Id = "second"
Name = "second"
},
}
};
@ -75,11 +75,11 @@ namespace Perspex.Controls.UnitTests
{
new TabItem
{
Id = "first"
Name = "first"
},
new TabItem
{
Id = "second"
Name = "second"
},
}
};
@ -94,7 +94,7 @@ namespace Perspex.Controls.UnitTests
{
return new ItemsPresenter
{
Id = "itemsPresenter",
Name = "itemsPresenter",
[~ItemsPresenter.ItemsProperty] = parent[~TabStrip.ItemsProperty],
};
}

14
Tests/Perspex.Controls.UnitTests/Templates/TemplateExtensionsTests.cs

@ -23,12 +23,12 @@ namespace Perspex.Controls.Templates.UnitTests
public void GetTemplateChildren_Should_Not_Return_Nested_Template_Controls()
{
var target = new TestTemplatedControl();
var border1 = new Border { Id = "border1", TemplatedParent = target };
var inner = new TestTemplatedControl { Id = "inner", TemplatedParent = target };
var border2 = new Border { Id = "border2", TemplatedParent = inner };
var border3 = new Border { Id = "border3", TemplatedParent = inner };
var border4 = new Border { Id = "border4", TemplatedParent = target };
var border5 = new Border { Id = "border5", TemplatedParent = null };
var border1 = new Border { Name = "border1", TemplatedParent = target };
var inner = new TestTemplatedControl { Name = "inner", TemplatedParent = target };
var border2 = new Border { Name = "border2", TemplatedParent = inner };
var border3 = new Border { Name = "border3", TemplatedParent = inner };
var border4 = new Border { Name = "border4", TemplatedParent = target };
var border5 = new Border { Name = "border5", TemplatedParent = null };
target.AddVisualChild(border1);
border1.Content = inner;
@ -37,7 +37,7 @@ namespace Perspex.Controls.Templates.UnitTests
border3.Content = border4;
border4.Content = border5;
var result = target.GetTemplateChildren().Select(x => x.Id).ToArray();
var result = target.GetTemplateChildren().Select(x => x.Name).ToArray();
Assert.Equal(new[] { "border1", "inner", "border4" }, result);
}

246
Tests/Perspex.Input.UnitTests/KeyboardNavigationTests.cs

@ -26,18 +26,18 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
new Button { Id = "Button1" },
(current = new Button { Id = "Button2" }),
(next = new Button { Id = "Button3" }),
new Button { Name = "Button1" },
(current = new Button { Name = "Button2" }),
(next = new Button { Name = "Button3" }),
}
}),
new StackPanel
{
Children = new Controls
{
new Button { Id = "Button4" },
new Button { Id = "Button5" },
new Button { Id = "Button6" },
new Button { Name = "Button4" },
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -64,18 +64,18 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
new Button { Id = "Button1" },
new Button { Id = "Button2" },
(current = new Button { Id = "Button3" }),
new Button { Name = "Button1" },
new Button { Name = "Button2" },
(current = new Button { Name = "Button3" }),
}
}),
new StackPanel
{
Children = new Controls
{
(next = new Button { Id = "Button4" }),
new Button { Id = "Button5" },
new Button { Id = "Button6" },
(next = new Button { Name = "Button4" }),
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -102,12 +102,12 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
new Button { Id = "Button1" },
new Button { Id = "Button2" },
(current = new Button { Id = "Button3" }),
new Button { Name = "Button1" },
new Button { Name = "Button2" },
(current = new Button { Name = "Button3" }),
}
}),
(next = new Button { Id = "Button4" }),
(next = new Button { Name = "Button4" }),
}
};
@ -136,9 +136,9 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
new Button { Id = "Button1" },
new Button { Id = "Button2" },
(current = new Button { Id = "Button3" }),
new Button { Name = "Button1" },
new Button { Name = "Button2" },
(current = new Button { Name = "Button3" }),
}
}),
},
@ -147,9 +147,9 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
(next = new Button { Id = "Button4" }),
new Button { Id = "Button5" },
new Button { Id = "Button6" },
(next = new Button { Name = "Button4" }),
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -170,7 +170,7 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
(next = new Button { Id = "Button1" }),
(next = new Button { Name = "Button1" }),
}
};
@ -199,9 +199,9 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
(next = new Button { Id = "Button1" }),
new Button { Id = "Button2" },
new Button { Id = "Button3" },
(next = new Button { Name = "Button1" }),
new Button { Name = "Button2" },
new Button { Name = "Button3" },
}
}),
},
@ -210,9 +210,9 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
new Button { Id = "Button4" },
new Button { Id = "Button5" },
(current = new Button { Id = "Button6" }),
new Button { Name = "Button4" },
new Button { Name = "Button5" },
(current = new Button { Name = "Button6" }),
}
},
}
@ -240,18 +240,18 @@ namespace Perspex.Input.UnitTests
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle,
Children = new Controls
{
new Button { Id = "Button1" },
(current = new Button { Id = "Button2" }),
(next = new Button { Id = "Button3" }),
new Button { Name = "Button1" },
(current = new Button { Name = "Button2" }),
(next = new Button { Name = "Button3" }),
}
}),
new StackPanel
{
Children = new Controls
{
new Button { Id = "Button4" },
new Button { Id = "Button5" },
new Button { Id = "Button6" },
new Button { Name = "Button4" },
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -279,18 +279,18 @@ namespace Perspex.Input.UnitTests
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle,
Children = new Controls
{
(next = new Button { Id = "Button1" }),
new Button { Id = "Button2" },
(current = new Button { Id = "Button3" }),
(next = new Button { Name = "Button1" }),
new Button { Name = "Button2" },
(current = new Button { Name = "Button3" }),
}
}),
new StackPanel
{
Children = new Controls
{
new Button { Id = "Button4" },
new Button { Id = "Button5" },
new Button { Id = "Button6" },
new Button { Name = "Button4" },
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -318,18 +318,18 @@ namespace Perspex.Input.UnitTests
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Once,
Children = new Controls
{
new Button { Id = "Button1" },
(current = new Button { Id = "Button2" }),
new Button { Id = "Button3" },
new Button { Name = "Button1" },
(current = new Button { Name = "Button2" }),
new Button { Name = "Button3" },
}
}),
new StackPanel
{
Children = new Controls
{
(next = new Button { Id = "Button4" }),
new Button { Id = "Button5" },
new Button { Id = "Button6" },
(next = new Button { Name = "Button4" }),
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -357,18 +357,18 @@ namespace Perspex.Input.UnitTests
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Once,
Children = new Controls
{
new Button { Id = "Button1" },
(next = new Button { Id = "Button2" }),
new Button { Id = "Button3" },
new Button { Name = "Button1" },
(next = new Button { Name = "Button2" }),
new Button { Name = "Button3" },
}
}),
new StackPanel
{
Children = new Controls
{
new Button { Id = "Button4" },
new Button { Id = "Button5" },
(current = new Button { Id = "Button6" }),
new Button { Name = "Button4" },
new Button { Name = "Button5" },
(current = new Button { Name = "Button6" }),
}
},
}
@ -398,18 +398,18 @@ namespace Perspex.Input.UnitTests
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Never,
Children = new Controls
{
new Button { Id = "Button1" },
(current = new Button { Id = "Button2" }),
new Button { Id = "Button3" },
new Button { Name = "Button1" },
(current = new Button { Name = "Button2" }),
new Button { Name = "Button3" },
}
}),
new StackPanel
{
Children = new Controls
{
(next = new Button { Id = "Button4" }),
new Button { Id = "Button5" },
new Button { Id = "Button6" },
(next = new Button { Name = "Button4" }),
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -437,18 +437,18 @@ namespace Perspex.Input.UnitTests
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Never,
Children = new Controls
{
new Button { Id = "Button1" },
new Button { Id = "Button2" },
new Button { Id = "Button3" },
new Button { Name = "Button1" },
new Button { Name = "Button2" },
new Button { Name = "Button3" },
}
}),
new StackPanel
{
Children = new Controls
{
(next = new Button { Id = "Button4" }),
new Button { Id = "Button5" },
(current = new Button { Id = "Button6" }),
(next = new Button { Name = "Button4" }),
new Button { Name = "Button5" },
(current = new Button { Name = "Button6" }),
}
},
}
@ -477,18 +477,18 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
new Button { Id = "Button1" },
(next = new Button { Id = "Button2" }),
(current = new Button { Id = "Button3" }),
new Button { Name = "Button1" },
(next = new Button { Name = "Button2" }),
(current = new Button { Name = "Button3" }),
}
}),
new StackPanel
{
Children = new Controls
{
new Button { Id = "Button4" },
new Button { Id = "Button5" },
new Button { Id = "Button6" },
new Button { Name = "Button4" },
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -515,18 +515,18 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
new Button { Id = "Button1" },
new Button { Id = "Button2" },
(next = new Button { Id = "Button3" }),
new Button { Name = "Button1" },
new Button { Name = "Button2" },
(next = new Button { Name = "Button3" }),
}
}),
new StackPanel
{
Children = new Controls
{
(current = new Button { Id = "Button4" }),
new Button { Id = "Button5" },
new Button { Id = "Button6" },
(current = new Button { Name = "Button4" }),
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -553,12 +553,12 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
new Button { Id = "Button1" },
new Button { Id = "Button2" },
(next = new Button { Id = "Button3" }),
new Button { Name = "Button1" },
new Button { Name = "Button2" },
(next = new Button { Name = "Button3" }),
}
}),
(current = new Button { Id = "Button4" }),
(current = new Button { Name = "Button4" }),
}
};
@ -587,9 +587,9 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
new Button { Id = "Button1" },
new Button { Id = "Button2" },
(next = new Button { Id = "Button3" }),
new Button { Name = "Button1" },
new Button { Name = "Button2" },
(next = new Button { Name = "Button3" }),
}
}),
},
@ -598,9 +598,9 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
(current = new Button { Id = "Button4" }),
new Button { Id = "Button5" },
new Button { Id = "Button6" },
(current = new Button { Name = "Button4" }),
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -631,9 +631,9 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
(current = new Button { Id = "Button1" }),
new Button { Id = "Button2" },
new Button { Id = "Button3" },
(current = new Button { Name = "Button1" }),
new Button { Name = "Button2" },
new Button { Name = "Button3" },
}
}),
},
@ -642,9 +642,9 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
new Button { Id = "Button4" },
new Button { Id = "Button5" },
(next = new Button { Id = "Button6" }),
new Button { Name = "Button4" },
new Button { Name = "Button5" },
(next = new Button { Name = "Button6" }),
}
},
}
@ -672,18 +672,18 @@ namespace Perspex.Input.UnitTests
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle,
Children = new Controls
{
(next = new Button { Id = "Button1" }),
(current = new Button { Id = "Button2" }),
new Button { Id = "Button3" },
(next = new Button { Name = "Button1" }),
(current = new Button { Name = "Button2" }),
new Button { Name = "Button3" },
}
}),
new StackPanel
{
Children = new Controls
{
new Button { Id = "Button4" },
new Button { Id = "Button5" },
new Button { Id = "Button6" },
new Button { Name = "Button4" },
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -711,18 +711,18 @@ namespace Perspex.Input.UnitTests
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Cycle,
Children = new Controls
{
(current = new Button { Id = "Button1" }),
new Button { Id = "Button2" },
(next = new Button { Id = "Button3" }),
(current = new Button { Name = "Button1" }),
new Button { Name = "Button2" },
(next = new Button { Name = "Button3" }),
}
}),
new StackPanel
{
Children = new Controls
{
new Button { Id = "Button4" },
new Button { Id = "Button5" },
new Button { Id = "Button6" },
new Button { Name = "Button4" },
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -749,9 +749,9 @@ namespace Perspex.Input.UnitTests
{
Children = new Controls
{
new Button { Id = "Button1" },
new Button { Id = "Button2" },
(next = new Button { Id = "Button3" }),
new Button { Name = "Button1" },
new Button { Name = "Button2" },
(next = new Button { Name = "Button3" }),
}
}),
new StackPanel
@ -759,9 +759,9 @@ namespace Perspex.Input.UnitTests
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Once,
Children = new Controls
{
new Button { Id = "Button4" },
(current = new Button { Id = "Button5" }),
new Button { Id = "Button6" },
new Button { Name = "Button4" },
(current = new Button { Name = "Button5" }),
new Button { Name = "Button6" },
}
},
}
@ -789,18 +789,18 @@ namespace Perspex.Input.UnitTests
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Once,
Children = new Controls
{
new Button { Id = "Button1" },
(next = new Button { Id = "Button2" }),
new Button { Id = "Button3" },
new Button { Name = "Button1" },
(next = new Button { Name = "Button2" }),
new Button { Name = "Button3" },
}
}),
new StackPanel
{
Children = new Controls
{
(current = new Button { Id = "Button4" }),
new Button { Id = "Button5" },
new Button { Id = "Button6" },
(current = new Button { Name = "Button4" }),
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}
@ -830,18 +830,18 @@ namespace Perspex.Input.UnitTests
[KeyboardNavigation.TabNavigationProperty] = KeyboardNavigationMode.Once,
Children = new Controls
{
(next = new Button { Id = "Button1" }),
new Button { Id = "Button2" },
new Button { Id = "Button3" },
(next = new Button { Name = "Button1" }),
new Button { Name = "Button2" },
new Button { Name = "Button3" },
}
}),
new StackPanel
{
Children = new Controls
{
(current = new Button { Id = "Button4" }),
new Button { Id = "Button5" },
new Button { Id = "Button6" },
(current = new Button { Name = "Button4" }),
new Button { Name = "Button5" },
new Button { Name = "Button6" },
}
},
}

2
Tests/Perspex.Styling.UnitTests/SelectorTests_Descendent.cs

@ -87,7 +87,7 @@ namespace Perspex.Styling.UnitTests
public abstract class TestLogical : ILogical, IStyleable
{
public abstract Classes Classes { get; }
public abstract string Id { get; }
public abstract string Name { get; }
public abstract IPerspexReadOnlyList<ILogical> LogicalChildren { get; }
public abstract ILogical LogicalParent { get; }
public Type StyleKey { get; }

24
Tests/Perspex.Styling.UnitTests/SelectorTests_Id.cs

@ -18,25 +18,25 @@ namespace Perspex.Styling.UnitTests
public void Id_Priority_Is_Style()
{
var control = new Control1();
var target = new Selector().Id("foo");
var target = new Selector().Name("foo");
Assert.Equal(BindingPriority.Style, target.Priority);
}
[Fact]
public void Id_Matches_Control_With_Correct_Id()
public void Id_Matches_Control_With_Correct_Name()
{
var control = new Control1 { Id = "foo" };
var target = new Selector().Id("foo");
var control = new Control1 { Name = "foo" };
var target = new Selector().Name("foo");
Assert.True(ActivatorValue(target, control));
}
[Fact]
public void Id_Doesnt_Match_Control_Of_Wrong_Id()
public void Id_Doesnt_Match_Control_Of_Wrong_Name()
{
var control = new Control1 { Id = "foo" };
var target = new Selector().Id("bar");
var control = new Control1 { Name = "foo" };
var target = new Selector().Name("bar");
Assert.False(ActivatorValue(target, control));
}
@ -45,7 +45,7 @@ namespace Perspex.Styling.UnitTests
public void Id_Doesnt_Match_Control_With_TemplatedParent()
{
var control = new Control1 { TemplatedParent = new Mock<ITemplatedControl>().Object };
var target = new Selector().Id("foo");
var target = new Selector().Name("foo");
Assert.False(ActivatorValue(target, control));
}
@ -53,8 +53,8 @@ namespace Perspex.Styling.UnitTests
[Fact]
public void When_Id_Matches_Control_Other_Selectors_Are_Subscribed()
{
var control = new Control1 { Id = "foo" };
var target = new Selector().Id("foo").SubscribeCheck();
var control = new Control1 { Name = "foo" };
var target = new Selector().Name("foo").SubscribeCheck();
var result = target.GetActivator(control).ToEnumerable().Take(1).ToArray();
@ -64,8 +64,8 @@ namespace Perspex.Styling.UnitTests
[Fact]
public void When_Id_Doesnt_Match_Control_Other_Selectors_Are_Not_Subscribed()
{
var control = new Control1 { Id = "foo" };
var target = new Selector().Id("bar").SubscribeCheck();
var control = new Control1 { Name = "foo" };
var target = new Selector().Name("bar").SubscribeCheck();
var result = target.GetActivator(control).ToEnumerable().Take(1).ToArray();

4
Tests/Perspex.Styling.UnitTests/SelectorTests_Multiple.cs

@ -22,7 +22,7 @@ namespace Perspex.Styling.UnitTests
{
return new Border
{
Id = "border",
Name = "border",
};
});
@ -38,7 +38,7 @@ namespace Perspex.Styling.UnitTests
.Class("foo")
.Class("bar")
.Template()
.Id("border");
.Name("border");
var border = (Border)((IVisual)control).VisualChildren.Single();
var values = new List<bool>();

2
Tests/Perspex.Styling.UnitTests/TestControlBase.cs

@ -17,7 +17,7 @@ namespace Perspex.Styling.UnitTests
this.SubscribeCheckObservable = new TestObservable();
}
public string Id { get; set; }
public string Name { get; set; }
public virtual Classes Classes { get; set; }

2
Tests/Perspex.Styling.UnitTests/TestTemplatedControl.cs

@ -17,7 +17,7 @@ namespace Perspex.Styling.UnitTests
get;
}
public abstract string Id
public abstract string Name
{
get;
}

Loading…
Cancel
Save