enisn / UraniumUI

Uranium is a Free & Open-Source UI Kit for MAUI.
Apache License 2.0
1.19k stars 143 forks source link

InputField prevent changing BindingContext of descendants #772

Closed enisn closed 2 months ago

enisn commented 2 months ago

Not the following syntax works as expected:

inputfield-expander-fix

<material:InputField Title="test" HasValue="True" Margin="60">
    <uranium:ExpanderView IsEnabled="True">
        <uranium:ExpanderView.Header>
            <Label Margin="10" FontAttributes="Bold" Text="TreeView Expander" />
        </uranium:ExpanderView.Header>
        <material:TreeView
                MinimumHeightRequest="120"
                 SelectionMode="Multiple"
                 x:Name="treeView"
                 ItemsSource="{Binding Nodes}"
                 LoadChildrenCommand="{Binding LoadChildrenCommand}"
                 IsLeafPropertyName="IsLeaf">
                <material:TreeView.ItemTemplate>
                    <DataTemplate>
                        <HorizontalStackLayout Spacing="5" VerticalOptions="Center">
                            <Image>
                                <Image.Triggers>
                                    <DataTrigger TargetType="Image" Binding="{Binding IsDirectory}" Value="True">
                                        <Setter Property="Source" Value="{FontImageSource FontFamily=MaterialSharp, Glyph={x:Static m:MaterialSharp.Folder}, Color={AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryDark}}}" />
                                    </DataTrigger>
                                    <DataTrigger TargetType="Image" Binding="{Binding IsDirectory}" Value="False">
                                        <Setter Property="Source" Value="{FontImageSource FontFamily=MaterialSharp, Glyph={x:Static m:MaterialSharp.File_open}, Color={AppThemeBinding Light={StaticResource Primary}, Dark={StaticResource PrimaryDark}}}" />
                                    </DataTrigger>
                                </Image.Triggers>
                            </Image>
                            <Label Text="{Binding Name}" FontAttributes="Bold" VerticalOptions="Center" />
                        </HorizontalStackLayout>
                    </DataTemplate>
                </material:TreeView.ItemTemplate>
            </material:TreeView>
    </uranium:ExpanderView>
</material:InputField>