导航后重新创建页面/列表视图。PushAsyncXamarin.forms

时间:2019-04-16 18:36:45

标签: c# listview xamarin.forms

我正在使用黑暗模式,但遇到了这些问题:

我在工具栏上有listView和设置按钮:dark_mode

当我切换ThemeMode时 Theme_switch 主题不会切换,但是当我导航到其他页面然后返回到Main_Menu时,我会遇到此问题:

Problem

重新启动应用程序后,就可以了。

如何刷新页面/列表视图? 请帮忙! 谢谢大家!

1 个答案:

答案 0 :(得分:0)

如果您希望在应用程序中达到深色模式,则可以使用这些软件包。

Xamarin.Forms.Themes.Base, https://www.nuget.org/packages/Xamarin.Forms.Theme.Base/

Xamarin.Forms.Themes.Dark https://www.nuget.org/packages/Xamarin.Forms.Theme.Dark/1.0.0.43-pre1

在您的 App.xaml

中添加关注代码
<?xml version="1.0" encoding="utf-8" ?>
<Application 
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:light="clr-namespace:Xamarin.Forms.Themes;assembly=Xamarin.Forms.Theme.Light"
xmlns:dark="clr-namespace:Xamarin.Forms.Themes;assembly=Xamarin.Forms.Theme.Dark"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyNamespace.MyApp">
<Application.Resources>
    <ResourceDictionary MergedWith="light:LightThemeResources">
        ...
    </ResourceDictionary>
</Application.Resources>