MAUI – unwanted button background color

I have a dotnet 8 MAUI IOS app that has a view that records the user. I receently updated the app from dotnet 7 to 8 and now I am having some styling issues on this page. The pause and reset buttons have a grey background at times. The background aren’t always there. It is dependent on which buttons are selected and the state of the view. Initially only reset and pause have the weird background. When you click play it is only reset and when you click stop it is only pause.

This is the area in question:

<Grid IsVisible="{Binding Path=BindingContext.IsControlsVisible, Source={x:Reference mainPage}}">
                    <Image Source="recording.png" ZIndex="1"/>
                    <FlexLayout WidthRequest="210" JustifyContent="SpaceBetween" AlignItems="Center" ZIndex="2">
                        <Button ImageSource="restart.png" BackgroundColor="Transparent" WidthRequest="80"
                                Clicked="ResetButtonClicked"
                                IsEnabled="{Binding Path=BindingContext.IsRestartButtonEnabled, Source={x:Reference mainPage}}"/>
                        <Button ImageSource="stop.png" BackgroundColor="Transparent" WidthRequest="80"
                                IsVisible="{Binding Path=BindingContext.IsStopButtonVisible, Source={x:Reference mainPage}}"
                                Command="{Binding Path=BindingContext.StopCommand, Source={x:Reference mainPage}}"/>
                        <Button ImageSource="start.png" BackgroundColor="Transparent" WidthRequest="80"
                                IsVisible="{Binding Path=BindingContext.IsRecordButtonVisible, Source={x:Reference mainPage}}"
                                Command="{Binding Path=BindingContext.RecordCommand, Source={x:Reference mainPage}}"/>
                        <Button ImageSource="pause.png" BackgroundColor="Transparent" WidthRequest="80"
                                Command="{Binding Path=BindingContext.PauseCommand, Source={x:Reference mainPage}}"
                                IsEnabled="{Binding Path=BindingContext.IsPauseButtonEnabled, Source={x:Reference mainPage}}"/>
                    </FlexLayout>
                    <Label ZIndex="2" Text="{Binding Path=BindingContext.TimerLabel, Source={x:Reference mainPage}}"
                           IsVisible="{Binding Path=BindingContext.IsCountupVisible, Source={x:Reference mainPage}}"
                           TextColor="{StaticResource AppGray}" FontSize="Large"
                           VerticalOptions="Center" HorizontalOptions="Center" Margin="6, 110, 0, 0"/>
                    <Label ZIndex="2" Text="{Binding Path=BindingContext.TimerRemainingLabel, Source={x:Reference mainPage}}"
                           IsVisible="{Binding Path=BindingContext.IsCountdownVisible, Source={x:Reference mainPage}}"
                           TextColor="Red" FontSize="Large"
                           VerticalOptions="Center" HorizontalOptions="Center" Margin="6, 110, 0, 0"/>
                </Grid>

This code is in the view model and handles when the buttons are clicked:

   public ICommand ResetCommand { get; set; }
   public ICommand PauseCommand { get; set; }

...

ResetCommand = new Command(ResetRecording);
PauseCommand = new Command(PauseRecording);

...

 private void PauseRecording()
        {
            if (recordAudioService != null)
            {
                isRecord = false;
                IsPauseButtonEnabled = false;
                IsStopButtonVisible = false;
                IsResumeButtonVisible = true;
                IsRecordButtonVisible = true;
                IsRestartButtonEnabled = true;
                recordAudioService.PauseRecord();
            }
        }

   private void ResetRecording()
        {
            if (IsRecordingAudio && !isRecord)
            {
                recordAudioService.ResetRecord();
                timerValue = new TimeSpan();
                timerRemainingValue = new TimeSpan();
                TimerLabel = string.Format("{0:mm\:ss}", timerValue);
                IsRecordingAudio = false;
                IsPauseButtonEnabled = false;
                IsResumeButtonVisible = false;
                IsStopButtonVisible = false;
                IsRestartButtonEnabled = false;
                CreateTimer();
                questionNumber = 1;
                RecordingStatus = "";
                IsAnswerRecorded = false;
            }
        }

I also recently updated these packages :

        <PackageReference Include="CommunityToolkit.Maui" Version="9.0.3" />
        <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
        <PackageReference Include="Plugin.Maui.Audio" Version="3.0.0" />
        <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.82" />
        <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.82" />

So maybe one of these has something to do with it?

Here is a picture of the issue in question:

I do not want that grey background around the pause button. That is the same background that shows up around the reset button as well.

4

I figured out what it was and now I feel kind of dumb. The grey background was due to the IsEnabled property on the button:

IsEnabled="{Binding Path=BindingContext.IsPauseButtonEnabled, Source={x:Reference mainPage}}"

The grey background was visible when the button was disabled. There is probably a more elegant way to avoid this but in my case it was easier to simply remove IsEnabled property.

I hope this is helpful to someone in the future.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật