ck_russ
Topic Author
Posts: 27
Joined: 20 May 2020, 14:41

Noesis reporting numerous errors/warnings about binding failures but working correctly

10 Jun 2020, 09:59

I'm getting a number of errors such as:
[NOESIS/W] Type 'Tests.ViewModel' does not contain a property named 'Row'
[NOESIS/E] Binding failed: Path=Row, Source=Tests.ViewModel(''), Target=ContentPresenter(''), TargetProperty=Grid.Row
[NOESIS/W] Type 'Tests.ViewModel' does not contain a property named 'Column'
[NOESIS/E] Binding failed: Path=Column, Source=Tests.ViewModel(''), Target=ContentPresenter(''), TargetProperty=Grid.Column

Here is a small project created to demonstrate the issue. I create a 2x2 ItemsControl Grid. It binds to a list of items. And the Row/Column where each item should be placed is specified in the item itself.
   
    <ItemsControl ItemsSource="{Binding ItemList}">
        <ItemsControl.DataContext>
            <local:ViewModel/>
        </ItemsControl.DataContext>
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                </Grid>
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <Label Content="{Binding Name}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
            </DataTemplate>
        </ItemsControl.ItemTemplate>
        <ItemsControl.ItemContainerStyle>
            <Style>
                <Setter Property="Grid.Row" Value="{Binding Row}"/>
                <Setter Property="Grid.Column" Value="{Binding Column}"/>
            </Style>
        </ItemsControl.ItemContainerStyle>
    </ItemsControl>

    
    class ViewModel
    {
        public ObservableCollection<Item> ItemList { get; } = new ObservableCollection<Item>();

        public ViewModel()
        {
            ItemList.Add(new Item());
        }
    }

    class Item
    {
        public int Column { get; } = 1;
        public int Row { get; } = 1;
        public string Name => $"[{Column},{Row}]";
    }
    
The program functions as it should and the databinding works as it should. The only issue are the errors. I'm seeing a very large number of errors/warnings along these lines in the main project and presumably unnecessary binding attempts.

Tags:
 
User avatar
sfernandez
Site Admin
Posts: 1920
Joined: 22 Dec 2011, 19:20

Re: Noesis reporting numerous errors/warnings about binding failures but working correctly

10 Jun 2020, 12:44

I found something wrong in our code leading to those unnecessary binding error messages.
We will fix it for the next release, thanks for pointing this out.
 
ck_russ
Topic Author
Posts: 27
Joined: 20 May 2020, 14:41

Re: Noesis reporting numerous errors/warnings about binding failures but working correctly

10 Jun 2020, 19:03

Great, thanks.

Who is online

Users browsing this forum: No registered users and 2 guests