[MAUI/Android] Release모드 시 BackgroundColor 적용 안되는 문제

마우이 안드로이드에서 Debug모드에서는 정상 작동 하지만 Release모드 시 BackgroundColor가 변경적용 안되는 문제가 있습니다.

//현재 해결방법
BackgroundColor => Background변경
BackgroundColor=“{StaticResource Gray500}”
Background=“{DynamicResource Gray500}”

https://github.com/dotnet/maui/issues/8961

Debug BackgroundColor (정상 동작)

debugBackgroundColor2

Release BackgroundColor (색상 안바뀜)
releaseBackgroundColor1releaseBackgroundColor2

Release Background (정상 동작)
releaseBackground1releaseBackground2

테스트 소스

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiApp3.MainPage">
    <ContentPage.Resources>
        <Color x:Key="green">#00ff00</Color>
    </ContentPage.Resources>

    <ScrollView>
        <VerticalStackLayout
            Spacing="25"
            Padding="30,0"
            VerticalOptions="Center">

            <Label Text="{Binding IsEnabled, Source={Reference label1}, StringFormat='IsEnabled: {0}'}"/>

            <Label x:Name="label1" 
                   Text="Welcome to .NET Multi-platform App UI"
                   FontSize="18"
                   HorizontalOptions="Center"
                   Background="{StaticResource green}">
                <Label.Triggers>
                    <DataTrigger TargetType="Label" Binding="{Binding IsEnabled, Source={RelativeSource Mode=Self}}" Value="False">
                        <Setter Property="Background" Value="{StaticResource Gray500}"/>
                    </DataTrigger>
                </Label.Triggers>
            </Label>

            <Button
                x:Name="CounterBtn"
                Text="Click me"
                SemanticProperties.Hint="Counts the number of times you click"
                Clicked="OnCounterClicked"
                HorizontalOptions="Center" />

        </VerticalStackLayout>
    </ScrollView>

</ContentPage>
namespace MauiApp3;

public partial class MainPage : ContentPage
{
	public MainPage()
	{
		InitializeComponent();
	}

	private void OnCounterClicked(object sender, EventArgs e)
	{
		label1.IsEnabled = false;        
	}
}
4개의 좋아요

@Nobody GitHub Maui 이슈에도 올려주셨네요!! 함께 공유해주셔서 감사합니다. :smile:

1개의 좋아요