dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.14k stars 1.74k forks source link

.Net MAUI Binding inside CollectionView Inside Datatemplate Inside ResourceDictionary #23350

Open trashhacker opened 3 months ago

trashhacker commented 3 months ago

Description

<?xml version="1.0" encoding="utf-8" ?> <ResourceDictionary xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:vmpresenter="clr-namespace:Intrinsic.Client.ViewModels.Presenter" xmlns:syncfusiondatagrid="clr-namespace:Syncfusion.Maui.DataGrid;assembly=Syncfusion.Maui.DataGrid" xmlns:syncprogressbar="clr-namespace:Syncfusion.Maui.ProgressBar;assembly=Syncfusion.Maui.ProgressBar" xmlns:syncfusion="http://schemas.syncfusion.com/maui" xmlns:material="http://schemas.enisn-projects.io/dotnet/maui/uraniumui/material" xmlns:vm="clr-namespace:Intrinsic.Client.ViewModels" x:Class="Intrinsic.Client.Resources.Templates">

<DataTemplate x:Key="reminderpresentertemplate" x:DataType="{x:Type vmpresenter:ReminderPresenterViewModel}">
    <Grid>
        <syncfusiondatagrid:SfDataGrid ItemsSource="{Binding Reminders}" SelectedRow="{Binding Selected}" AutoGenerateColumnsMode="None" AllowEditing="False"
                           AllowDeleting="False" AllowDraggingColumn="False"  ColumnWidthMode="Fill" BackgroundColor="White">
            <syncfusiondatagrid:SfDataGrid.Columns>
                <syncfusiondatagrid:DataGridTextColumn HeaderText="{DynamicResource name}" DisplayBinding="{Binding Name}"/>
                <syncfusiondatagrid:DataGridTextColumn HeaderText="{DynamicResource started}" DisplayBinding="{Binding Started}"/>
                <syncfusiondatagrid:DataGridTextColumn HeaderText="{DynamicResource appointment}" DisplayBinding="{Binding Appointment}"/>
                <syncfusiondatagrid:DataGridTemplateColumn HeaderText="{DynamicResource remaining}" >
                    <syncfusiondatagrid:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate x:DataType="{x:Type vm:ReminderViewModel}">
                            <syncprogressbar:SfLinearProgressBar  />
                            <!--Progress="{Binding Progress, Mode=OneWay}" Maximum="1" Minimum="0" Background="Transparent"
                                           ProgressFill="{Binding Expired, Converter={StaticResource reminderprogressconverter}}"-->
                        </DataTemplate>
                    </syncfusiondatagrid:DataGridTemplateColumn.CellTemplate>
                </syncfusiondatagrid:DataGridTemplateColumn>
            </syncfusiondatagrid:SfDataGrid.Columns>

        </syncfusiondatagrid:SfDataGrid>
    </Grid>
</DataTemplate>

  1. If i use the x:DataType on the CollectinView.Itemtemplate: the debbuger (Error Analysier at Compliletime) says that the binding has a wrong string format

  2. if i remove it: it says the property is not found... again at compile time

but i tried it with an converter and the correct value is passed but visual studio marks it as an error

github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

trashhacker commented 3 months ago

ok i have checked the other issues... its not a duplicate, its kinda related ok... but this is a bug that has nothing to to with the sugested issues so pls can i have a visite or an answere from your code gurus :D

trashhacker commented 3 months ago

yea code gurus come from heaven to help me :D https://github.com/trashhacker/ReproBindingError

im sorry i did not read your guidlines for repos (: hope its ok

and yea its not only collectionview its more the datatemplate inside the what ever collection -- my bad sorry

if you remove

                        <Label Text="{Binding Identifier}"/>
                        <Label Text="{Binding Description}"/>

it will compile and if u copy and past it while debugging it will work too