Browse Source

WIP

pull/156/head
Nelson Carrillo 11 years ago
parent
commit
b491c0ec25
  1. 25
      samples/TestApplication/GalleryStyle.cs
  2. 215
      samples/TestApplication/Program.cs
  3. 17
      src/Perspex.Themes.Default/ButtonStyle.cs
  4. 4
      src/Perspex.Themes.Default/CheckBoxStyle.cs
  5. 2
      src/Perspex.Themes.Default/TabItemStyle.cs

25
samples/TestApplication/GalleryStyle.cs

@ -27,7 +27,7 @@ namespace TestApplication
}
},
new Style(s => s.Class(":container").OfType<TabControl>().Child().Child().Child().Child().OfType<TabItem>())
new Style(s => s.Class(":container").OfType<TabControl>().Child().Child().Child().Child().Child().OfType<TabItem>())
{
Setters = new[]
{
@ -35,7 +35,7 @@ namespace TestApplication
}
},
new Style(s => s.Class(":container").Child().Child().Child().Child().OfType<TabItem>())
new Style(s => s.Name("internalStrip").OfType<TabStrip>().Child().OfType<TabItem>())
{
Setters = new[]
{
@ -44,7 +44,7 @@ namespace TestApplication
}
},
new Style(s => s.Class(":container").Child().Child().Child().Child().OfType<TabItem>().Class("selected"))
new Style(s => s.Name("internalStrip").OfType<TabStrip>().Child().OfType<TabItem>().Class("selected"))
{
Setters = new[]
{
@ -90,15 +90,18 @@ namespace TestApplication
{
new Border
{
Width = 170,
Background = SolidColorBrush.Parse("#373749"),
Child = new TabStrip
Width = 190,
Background = SolidColorBrush.Parse("#1976D2"),
Child = new ScrollViewer
{
ItemsPanel = new FuncTemplate<IPanel>(() => new StackPanel { Orientation = Orientation.Vertical, Gap = 4 }),
Margin = new Thickness(0, 10, 0, 0),
Name = "containerTabStrip",
[!ItemsControl.ItemsProperty] = control[!ItemsControl.ItemsProperty],
[!!SelectingItemsControl.SelectedItemProperty] = control[!!SelectingItemsControl.SelectedItemProperty],
Content = new TabStrip
{
ItemsPanel = new FuncTemplate<IPanel>(() => new StackPanel { Orientation = Orientation.Vertical, Gap = 4 }),
Margin = new Thickness(0, 10, 0, 0),
Name = "internalStrip",
[!ItemsControl.ItemsProperty] = control[!ItemsControl.ItemsProperty],
[!!SelectingItemsControl.SelectedItemProperty] = control[!!SelectingItemsControl.SelectedItemProperty],
}
}
},
new Deck

215
samples/TestApplication/Program.cs

@ -155,97 +155,67 @@ namespace TestApplication
var result = new TabItem
{
Header = "Buttons",
Header = "Button",
Content = new StackPanel
{
Margin = new Thickness(10),
Orientation = Orientation.Vertical,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Gap = 8,
MinWidth = 120,
Gap = 4,
Children = new Controls
{
(showDialogButton = new Button
{
Content = "Button",
Command = showDialog,
[ToolTip.TipProperty] = "Hello World!",
}),
new Button
new TextBlock
{
Content = "Button",
Background = new SolidColorBrush(0xcc119eda),
[ToolTip.TipProperty] = "Goodbye Cruel World!",
Text = "Button",
FontWeight = FontWeight.Medium,
FontSize = 22,
Foreground = SolidColorBrush.Parse("#212121"),
},
(defaultButton = new Button
{
Content = "Default",
IsDefault = true,
}),
new Button
new TextBlock
{
Content = "Disabled",
IsEnabled = false,
Text = "A button control",
FontSize = 14,
Foreground = SolidColorBrush.Parse("#727272"),
Margin = new Thickness(0, 0, 0, 10)
},
new Button
{
Content = "Disabled",
IsEnabled = false,
Background = new SolidColorBrush(0xcc119eda),
},
new ToggleButton
{
Content = "Toggle",
Width = 150,
Content = "Button"
},
new ToggleButton
new Button
{
Width = 150,
Content = "Disabled",
IsEnabled = false,
},
new CheckBox
{
Content = "Checkbox",
},
new RadioButton
new TabControl
{
Content = "RadioButton 1",
IsChecked = true,
},
new RadioButton
{
Content = "RadioButton 2",
},
}
},
};
defaultButton.Click += (s, e) =>
{
defaultButton.Content = ((string)defaultButton.Content == "Default") ? "Clicked" : "Default";
};
showDialog.Subscribe(async _ =>
{
var close = ReactiveCommand.Create();
Margin = new Thickness(0, 20, 0, 0),
var dialog = new Window
{
Content = new StackPanel
{
Width = 200,
Height = 200,
Children = new Controls
{
new Button { Content = "Yes", Command = close, CommandParameter = "Yes" },
new Button { Content = "No", Command = close, CommandParameter = "No" },
Items = new []
{
new TabItem
{
Header = new TextBlock { FontWeight = FontWeight.Medium, Text = "CSHARP" },
Content = new HtmlLabel
{
Text = "CSHRP CODEZ"
}
},
new TabItem
{
Header = new TextBlock { FontWeight = FontWeight.Medium, Text = "XAML" },
Content = new HtmlLabel
{
Text = "XAML CODEZ"
}
}
}
}
}
};
close.Subscribe(x => dialog.Close(x));
showDialogButton.Content = await dialog.ShowDialog<string>();
});
},
};
return result;
}
@ -257,7 +227,7 @@ namespace TestApplication
.ReadToEnd();
return new TabItem
{
Header = "Html",
Header = "HTML Label",
Content = new ScrollViewer()
{
Width = 600,
@ -278,50 +248,99 @@ namespace TestApplication
{
return new TabItem
{
Header = "Text",
Header = "Input",
Content = new StackPanel
{
Margin = new Thickness(10),
Orientation = Orientation.Vertical,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Gap = 8,
Width = 120,
Gap = 4,
Children = new Controls
{
new TextBlock
{
Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt.",
TextWrapping = TextWrapping.Wrap,
TextAlignment = TextAlignment.Center,
Text = "Check box",
FontWeight = FontWeight.Medium,
FontSize = 22,
Foreground = SolidColorBrush.Parse("#212121"),
},
new TextBlock
{
Text = "Italic text.",
FontStyle = FontStyle.Italic,
TextAlignment = TextAlignment.Left,
Text = "A check box control",
FontSize = 14,
Foreground = SolidColorBrush.Parse("#373749"),
Margin = new Thickness(0, 0, 0, 10)
},
new TextBlock
new CheckBox { IsChecked = true, Margin = new Thickness(0, 0, 0, 5), Content = "Checked" },
new CheckBox { IsChecked = false, Content = "Unchecked" },
new TabControl
{
Text = "Bold text.",
FontWeight = FontWeight.Bold,
TextAlignment = TextAlignment.Right,
Margin = new Thickness(0, 20, 0, 0),
Items = new []
{
new TabItem
{
Header = new TextBlock { FontWeight = FontWeight.Medium, Text = "CSHARP" },
Content = new HtmlLabel
{
Text = "CSHRP CODEZ"
}
},
new TabItem
{
Header = new TextBlock { FontWeight = FontWeight.Medium, Text = "XAML" },
Content = new HtmlLabel
{
Text = "XAML CODEZ"
}
}
}
},
new TextBox
new TextBlock
{
Text = "A non-wrapping text box. Lorem ipsum dolor sit amet.",
TextWrapping = TextWrapping.NoWrap,
Margin = new Thickness(0, 40, 0, 0),
Text = "Radio button",
FontWeight = FontWeight.Medium,
FontSize = 22,
Foreground = SolidColorBrush.Parse("#373749"),
},
new TextBox
new TextBlock
{
AcceptsReturn = true,
Text = "A wrapping text box. " +
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt. " +
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin venenatis dui quis libero suscipit tincidunt.",
TextWrapping = TextWrapping.Wrap,
MaxHeight = 100,
Text = "A radio button control",
FontSize = 14,
Foreground = SolidColorBrush.Parse("#373749"),
Margin = new Thickness(0, 0, 0, 10)
},
new RadioButton { IsChecked = true, Margin = new Thickness(0, 0, 0, 5), Content = "Option 1" },
new RadioButton { IsChecked = false, Content = "Option 2" },
new RadioButton { IsChecked = false, Content = "Option 3" },
new TabControl
{
Margin = new Thickness(0, 20, 0, 0),
Items = new []
{
new TabItem
{
Header = new TextBlock { FontWeight = FontWeight.Medium, Text = "CSHARP" },
Content = new HtmlLabel
{
Text = "CSHRP CODEZ"
}
},
new TabItem
{
Header = new TextBlock { FontWeight = FontWeight.Medium, Text = "XAML" },
Content = new HtmlLabel
{
Text = "XAML CODEZ"
}
}
}
}
}
},
}
};
}

17
src/Perspex.Themes.Default/ButtonStyle.cs

@ -30,8 +30,8 @@ namespace Perspex.Themes.Default
{
Setters = new[]
{
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xffdddddd)),
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xff707070)),
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xffaaaaaa)),
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xffaaaaaa)),
new Setter(TemplatedControl.BorderThicknessProperty, 2),
new Setter(TemplatedControl.ForegroundProperty, new SolidColorBrush(0xff000000)),
new Setter(Control.FocusAdornerProperty, new FuncTemplate<IControl>(FocusAdornerTemplate)),
@ -44,22 +44,15 @@ namespace Perspex.Themes.Default
{
Setters = new[]
{
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xffbee6fd)),
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xff3c7fb1)),
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xff888888)),
},
},
new Style(x => x.OfType<Button>().Class(":pointerover").Class(":pressed").Template().Name("border"))
{
Setters = new[]
{
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xffc4e5f6)),
},
},
new Style(x => x.OfType<Button>().Class(":pressed").Template().Name("border"))
{
Setters = new[]
{
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xffff628b)),
new Setter(TemplatedControl.BorderBrushProperty, new SolidColorBrush(0xff888888)),
new Setter(TemplatedControl.BackgroundProperty, new SolidColorBrush(0xff888888)),
},
},
new Style(x => x.OfType<Button>().Class(":disabled").Template().Name("contentPresenter"))

4
src/Perspex.Themes.Default/CheckBoxStyle.cs

@ -73,7 +73,7 @@ namespace Perspex.Themes.Default
new Border
{
Name = "checkBorder",
BorderBrush = Brushes.Black,
BorderBrush = new SolidColorBrush(0xff333333),
BorderThickness = 2,
Width = 18,
Height = 18,
@ -83,7 +83,7 @@ namespace Perspex.Themes.Default
new Path
{
Name = "checkMark",
Fill = Brushes.Black,
Fill = new SolidColorBrush(0xff333333),
Width = 11,
Height = 10,
Stretch = Stretch.Uniform,

2
src/Perspex.Themes.Default/TabItemStyle.cs

@ -27,7 +27,7 @@ namespace Perspex.Themes.Default
{
Setters = new[]
{
new Setter(TemplatedControl.FontSizeProperty, 28.7),
new Setter(TemplatedControl.FontSizeProperty, 16.0),
new Setter(TemplatedControl.ForegroundProperty, Brushes.Gray),
new Setter(TemplatedControl.TemplateProperty, new ControlTemplate<TabItem>(Template)),
},

Loading…
Cancel
Save