ToggleThemeButton not visible in version 24.1

Themes, Shared, and Core Libraries for Avalonia UI Forum

Posted 21 days ago by Seuntjie
Avatar

I have a togglethemebutton that worked perfectly in version 23.*, but since upgrading to 24.1, it is not visible

<Expander IsExpanded="True" Width="200" Margin="5" Header="{Binding}">
    <Expander.HeaderTemplate>
        <DataTemplate x:DataType="vm:GeneralSettingsViewModel">
            <Grid>
                <TextBlock Text="{DynamicResource Localization.AppSettings.LookAndFeel}" HorizontalAlignment="Center"/>
            </Grid>
        </DataTemplate>
    </Expander.HeaderTemplate>
    <StackPanel >
        <actipro:ToggleThemeButton IsEnabled="True" IsVisible="True" Background="Red" MinHeight="25" MinWidth="25" />
        <TextBlock Text="Colour scheme"/>
        <ComboBox SelectedItem="{Binding UiSettings.ThemeName}" />
        <TextBlock Text="Should I offer multiple layouts here?"/>
        <ComboBox />
    </StackPanel>
</Expander>

https://imgur.com/Riefrfj.png

I also have the button in a different location in a task bar kind of setup, and it doesn't display either:

<Border  DockPanel.Dock="Bottom" Height="30" VerticalAlignment="Bottom" BorderThickness="1" BorderBrush="{DynamicResource SystemChromeGrayColor}" Padding="3">
    <Grid VerticalAlignment="Center">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="3*" />
            <ColumnDefinition Width="3*" />
            <ColumnDefinition  Width="auto"/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" >
            <Image Source="{SvgImage /Assets/Images/bxs-user-check.svg}" IsVisible="{Binding LoggedIn}"/>
            <Image Source="{SvgImage /Assets/Images/bxs-user-x.svg}" IsVisible="{Binding NotLoggedIn}"/>
            <Image Source="{SvgImage /Assets/Images/bx-run.svg}" IsVisible="{Binding Running}"/>
            <Image Source="{SvgImage /Assets/Images/bx-stop.svg}" IsVisible="{Binding Stopped}"/>
            <TextBlock Text="Status: " VerticalAlignment="Bottom"/>
            <TextBlock Text="{Binding StatusMessage}"/>
        </StackPanel>
        <StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Stretch" >
            <TextBlock Text="Last Action: "/>
            <TextBlock Text="{Binding LastAction}"/>
        </StackPanel>
        <actipro:ToggleThemeButton Grid.Column="2" />
    </Grid>
</Border>

I tried creating a blank avalonia desktop app, adding the Actipro shared components, setting the theme to modern and adding the toggle theme button and it doesn't show:

https://imgur.com/fC1yXcq.png

I can see that it works in the sample browser but can't reproduce it.

Comments (2)

Answer - Posted 21 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Thank you for brining this to our attention.  A recent change impacted the default theme for CopyButton and ToggleThemeButton that was not exposed in our own Sample Browser application.  Until we have a fix in the next maintenance release, you can work around the issue by adding the following line in App.Initialize to ensure some necessary resources are loaded before the controls are used.

public partial class App : Application
{
    public override void Initialize()
    {
        AvaloniaXamlLoader.Load(this);

        // Workaround for default ToggleThemeButton theme in Actipro Avalonia v24.1.0
        _ = ActiproSoftware.Properties.Shared.AssemblyInfo.Instance;
    }

    ...
}


Actipro Software Support

Posted 18 days ago by Seuntjie
Avatar

Thank you, that resolved the problem.

Add Comment

Please log in to a validated account to post comments.