弹出背景尊重浅色/深色主题?
我的 XAML 中有以下内容,这对于深色主题非常有用。当我切换白色/浅色主题时,它会更改文本颜色,但不会更改背景。从边框中删除背景属性只会使其透明。
有人可以帮忙吗?
<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>
I have the following in my XAML and this works great with the dark theme. When I switch the 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用主题资源,它们将根据用户的主题选择自动调整。它们在这里有详细说明。
Windows Phone 主题资源
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
您明确设置背景颜色(为“#CA000000”),您是否希望框架/操作系统覆盖它?
设置适用于两个主题的颜色或根据所选主题更改颜色。
您可以在 https://stackoverflow.com/ 找到有关检测当前主题的建议搜索?q=%5Bwindows-phone-7%5D+检测+主题
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