弹出背景尊重浅色/深色主题?

发布于 2024-10-12 07:58:03 字数 1496 浏览 3 评论 0原文

我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

故事和酒 2024-10-19 07:58:03

如果您使用主题资源,它们将根据用户的主题选择自动调整。它们在这里有详细说明。

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

提笔书几行 2024-10-19 07:58:03

您明确设置背景颜色(为“#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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文