enisn / TreeView.Maui

A simple treeview control for MAUI
MIT License
38 stars 8 forks source link

Toggle Icon background color on custom background color element #5

Closed higty closed 1 year ago

higty commented 1 year ago

Hi. Thank you for your great work with splendid treeview.

I have some problem when using this treeview. It is about toggle icon that the background color of it is not good when on custom BackgroundColor element.

Download Sandbox.TreeView project. Change BackgroundColor to Gray.

<?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" xmlns:local="clr-namespace:SandboxTreeView" xmlns:t="clr-namespace:TreeView.Maui.Controls;assembly=TreeView.Maui" x:Class="SandboxTreeView.MainPage">

<ContentPage.BindingContext>
    <local:MainPageViewModel />
</ContentPage.BindingContext>
<ContentPage.Content>

    <ScrollView>
        <StackLayout>
            <t:TreeView ItemsSource="{Binding Nodes}" BackgroundColor="Gray">
            </t:TreeView>
        </StackLayout>
    </ScrollView>

</ContentPage.Content>

image

Is there any workaround??

higty commented 1 year ago
    var extendButton = new ImageButton
    {
        Source = Application.Current.RequestedTheme == AppTheme.Dark ? "down_light.png" : "down_dark.png",
        BackgroundColor = Transparent, <----
        VerticalOptions = LayoutOptions.Center,
        Opacity = node.IsLeaf ? 0 : 1,
        Rotation = node.IsExtended ? 0 : -90,
        HeightRequest = 30,
        WidthRequest = 30,
    };

Maybe it is better to set transparent in TreeViewNodeView class?

enisn commented 1 year ago
    var extendButton = new ImageButton
    {
        Source = Application.Current.RequestedTheme == AppTheme.Dark ? "down_light.png" : "down_dark.png",
        BackgroundColor = Transparent, <----
        VerticalOptions = LayoutOptions.Center,
        Opacity = node.IsLeaf ? 0 : 1,
        Rotation = node.IsExtended ? 0 : -90,
        HeightRequest = 30,
        WidthRequest = 30,
    };

Maybe it is better to set transparent in TreeViewNodeView class?

Yes, you're right, I'll change it like this when I find some time. By the way, PR is always welcome