Created
August 23, 2017 11:14
-
-
Save ewanharris/21b051884a6483db770514c498c19c92 to your computer and use it in GitHub Desktop.
XAML Style tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var win = Ti.UI.createWindow({ backgroundColor: 'white' }); | |
var lbl = Ti.UI.createLabel({text: 'label', top: 0}); | |
var btn = Ti.UI.createButton({title: 'button', top: 50}); | |
var sb = Ti.UI.createSearchBar({top: 150}); | |
var view = Ti.UI.createView({top:250, width: 100, height: 100}); | |
var style = Ti.UI.Windows.createStyle({ source: 'ms-appx:///Style.xaml' }); | |
style.apply(lbl, 'LabelStyle'); | |
style.apply(btn, 'ButtonStyle'); | |
style.apply(view, 'ViewStyle'); | |
style.apply(sb, 'SBStyle') | |
win.add(btn) | |
win.add(sb) | |
win.add(view) | |
win.add(lbl); | |
win.open(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ResourceDictionary | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | |
<ResourceDictionary.ThemeDictionaries> | |
<ResourceDictionary x:Key="Light"> | |
<SolidColorBrush x:Key="ButtonBorderBrush" Color="Blue"/> | |
<SolidColorBrush x:Key="ButtonBorderBrushPointerOver" Color="Pink"/> | |
<SolidColorBrush x:Key="ButtonBorderBrushPressed" Color="Yellow"/> | |
</ResourceDictionary> | |
</ResourceDictionary.ThemeDictionaries> | |
<Style x:Key="ButtonStyle" TargetType="Button"> | |
<Setter Property="Foreground" Value="Plum" /> | |
</Style> | |
<Style x:Key="ViewStyle" TargetType="Canvas"> | |
<Setter Property="Background" Value="Blue"/> | |
</Style> | |
<Style x:Key="LabelStyle" TargetType="TextBlock"> | |
<Setter Property="Foreground" Value="Plum"></Setter> | |
</Style> | |
<Style x:Key="SBStyle" TargetType="AutoSuggestBox"> | |
<Setter Property="Foreground" Value="Purple"/> | |
<Setter Property="Background" Value="Purple"/> | |
</Style> | |
</ResourceDictionary> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment