|
|
@ -1,4 +1,6 @@
|
|
|
|
namespace ex_CustomToolbar;
|
|
|
|
using CommunityToolkit.Maui.Behaviors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace ex_CustomToolbar;
|
|
|
|
|
|
|
|
|
|
|
|
public partial class MainPage : ContentPage
|
|
|
|
public partial class MainPage : ContentPage
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -21,6 +23,33 @@ public partial class MainPage : ContentPage
|
|
|
|
SemanticScreenReader.Announce(CounterBtn.Text);
|
|
|
|
SemanticScreenReader.Announce(CounterBtn.Text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void picker_SelectedIndexChanged(object source, EventArgs args)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
string? chosenThemeString = picker.SelectedItem as string;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ResourceDictionary chosenTheme = chosenThemeString switch
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"Dark" => new DarkTheme(),
|
|
|
|
|
|
|
|
"Light" => new LightTheme(),
|
|
|
|
|
|
|
|
"Color Blind" => new ColorBlindTheme(),
|
|
|
|
|
|
|
|
_ => new LightTheme()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ICollection<ResourceDictionary> mergedDictionaries = Application.Current.Resources.MergedDictionaries;
|
|
|
|
|
|
|
|
if (mergedDictionaries != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
foreach(var dico in mergedDictionaries.Where(d => d is ICustomTheme).ToList())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mergedDictionaries.Remove(dico);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
mergedDictionaries.Add(chosenTheme);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ANDROID
|
|
|
|
|
|
|
|
CommunityToolkit.Maui.Core.Platform.StatusBar.SetColor((Color)Application.Current.Resources["PrimaryBackgroundColor"]);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void EllipsisClicked(object sender, EventArgs e)
|
|
|
|
private void EllipsisClicked(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
secondaryMenu.IsVisible = !secondaryMenu.IsVisible;
|
|
|
|
secondaryMenu.IsVisible = !secondaryMenu.IsVisible;
|
|
|
|