Skip to content

Instantly share code, notes, and snippets.

@mrlacey
Last active December 28, 2015 16:19
Show Gist options
  • Save mrlacey/7527743 to your computer and use it in GitHub Desktop.
Save mrlacey/7527743 to your computer and use it in GitHub Desktop.
XAML that demonstrates issue with CaretBrush and shared resources
<phone:PhoneApplicationPage
x:Class="CaretBrushTest.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
SupportedOrientations="Portrait"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.Resources>
<SolidColorBrush Color="#FF00FF" x:Key="MyColor" />
</phone:PhoneApplicationPage.Resources>
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="CARETBRUSH SHARED RESOURCE TEST" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
</StackPanel>
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBox CaretBrush="{StaticResource MyColor}" />
<Button Grid.Column="1" Content="something" Foreground="{StaticResource MyColor}" />
<TextBlock Grid.Row="1" Grid.ColumnSpan="2" Foreground="{StaticResource MyColor}" Style="{StaticResource PhoneTextLargeStyle}">do i flash?</TextBlock>
<TextBlock Grid.Row="2" Grid.ColumnSpan="2" Foreground="#FF00FF" Style="{StaticResource PhoneTextLargeStyle}">another flasher?</TextBlock>
<Rectangle Grid.Row="3" Grid.ColumnSpan="2" Fill="{StaticResource MyColor}" Height="50" />
</Grid>
</Grid>
</phone:PhoneApplicationPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment