Background Image affecting ComboBox Background - Advanced Installer Community
khrave
Posts: 3
Joined: Wed Dec 06, 2023 10:18 pm

Background Image affecting ComboBox Background

Hi,

When using the Air -> Flat theme, I have a dark, gradient background. I've successfully modified some custom checkboxes due to previous problems, but now I am experiencing the background of an unselected combobox being darkened as if it was disabled. This only happens on dark backgrounds.

Is there a way to disable this behavior or a workaround for it? I'd like to not use a ListBox as opposed to a ComboBox.

Here are some screenshots and a sample .aip file.


Thanks!
Attachments
Testthing.aip
(23.12 KiB) Downloaded 232 times
ExampleSS.png
ExampleSS.png (119.81 KiB) Viewed 4900 times
Liviu
Posts: 1419
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Background Image affecting ComboBox Background

Hello,

This seems to happen when the WinUI rendering option is enabled.

I have forwarded this to our development team and this will be fixed in a future version of Advanced Installer. As soon as the fix will be released we will notify you on this forum thread.

The only workaround for the moment will be to disable this option.

We apologize for the inconvenience and appreciate your patience.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
khrave
Posts: 3
Joined: Wed Dec 06, 2023 10:18 pm

Re: Background Image affecting ComboBox Background

Acknowledged. Thanks for the investigation and response!
Liviu
Posts: 1419
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Background Image affecting ComboBox Background

You're always welcome!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Liviu
Posts: 1419
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Background Image affecting ComboBox Background

Hello,

We have news on how to solve this problem. You can use a custom XAML file for Checkbox controls when using the WinUI feature.

1. Create a new file named "ComboBox.xaml" with the following content:

Code: Select all

<ComboBox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
          mc:Ignorable="d">
  <ComboBox.Resources>
    <Style TargetType="ComboBox">
      <Setter Property="Background" Value="White" />
	  <Setter Property="BorderBrush" Value="Gray" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="ComboBox">
            <Grid x:Name="LayoutRoot">
              <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                  <VisualState x:Name="Normal">
                    <Storyboard>
                      <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="Background">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="White" />
                      </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                  <VisualState x:Name="PointerOver">
                    <Storyboard>
                      <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="Background">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="White" />
                      </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                  <VisualState x:Name="Pressed">
                    <Storyboard>
                      <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="Background">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="White" />
                      </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                  <VisualState x:Name="Disabled">
                    <Storyboard>
                      <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="Background">
                        <DiscreteObjectKeyFrame KeyTime="0" Value="DarkGray" />
                      </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                  </VisualState>
                </VisualStateGroup>
              </VisualStateManager.VisualStateGroups>
              <Border x:Name="Background" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
              </Border>
              <Popup x:Name="Popup">
                <Border Background="White" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1">
                  <ScrollViewer>
                    <ItemsPresenter />
                  </ScrollViewer>
                </Border>
              </Popup>
            </Grid>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  </ComboBox.Resources>
</ComboBox>

You can change the colors as you wish.

<VisualState x:Name="Normal">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="White" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>

2. Go to the Themes page --> Images tab and create a new property:

Property name: ComboBox
Image path: the above XAML file
themes page.png
themes page.png (36.48 KiB) Viewed 4758 times

3. Build and test the package.

Hope this helps! Let us know if you have any questions.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”