Popup Background honours light/dark theme?
I have the following in my XAML and this works great with the dark theme. When I switch t开发者_如何学Pythonhe the white/light theme it changes the text colour but not the background. Removing the Background property from the border just makes it transparent.
Can anyone help?
<Popup x:Name="PinDetailsPopup" Margin="45,0,28,94" Height="70" VerticalAlignment="Bottom" RenderTransformOrigin="0.5,0.5" Opacity="0.75" >
<Popup.RenderTransform>
<CompositeTransform/>
</Popup.RenderTransform>
<Border Height="70" Width="400" CornerRadius="10" BorderBrush="Black" BorderThickness="2" Background="#CA000000" >
<Grid DataContext="{Binding SelectedPin}">
<TextBlock TextWrapping="Wrap" Text="{Binding Name, Mode=OneWay}" Margin="10,0,0,0"/>
<TextBlock TextWrapping="Wrap" HorizontalAlignment="Center" Text="{Binding flightno, Mode=OneWay}" Margin="10,0,0,0"/>
<TextBlock TextWrapping="Wrap" Text="{Binding route, Mode=OneWay}" Margin="10,30,0,-22"/>
<TextBlock TextWrapping="Wrap" HorizontalAlignment="Center" Text="{Binding feet, Mode=OneWay}" Margin="10,30,0,0"/>
<Button Click="detailsClick" Content="More" HorizontalAlignment="Right" d:LayoutOverrides="Height" Margin="0,0,8,0"/>
</Grid>
</Border>
</Popup>
If you use the theme resources, they will automatically adjust based on the users theme choice. They are detailed here.
Theme Resources for Windows Phone
You're explicitly setting the background color (to "#CA000000") were you expecting this to be overriddden by the Framework/OS?
Either set a color that works in both themes or change the color depending on the selected theme.
You'll find advice on detecting the current theme at https://stackoverflow.com/search?q=%5Bwindows-phone-7%5D+detect+theme
精彩评论