Issue with DesignInstance

Hi,

I like the support for the DesignInstance markup extenson in the designer (R# 6, 6.0.2202.688 on VS 10.0.40219.1), but it seems to behave strangely with DataGrids.

I have a pseudo-view model like this:

    public class MainViewModel {

        public ObservableCollection<ChildViewModel> Children { get; set; }
    }

    public class ChildViewModel {

        public string S1 { get; set; }

    }

And a XAML file using both:

<Window
    x:Class="DataContextBinding.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ViewModel="clr-namespace:DataContextBinding.ViewModel"
    mc:Ignorable="d"
    d:DataContext="{d:DesignInstance ViewModel:MainViewModel}"   
        >

    <Grid>
        <ListBox ItemsSource="{Binding Path=Children}">
            <ListBox.ItemTemplate>

                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Path=S1}" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <DataGrid ItemsSource="{Binding Children}">

            <DataGrid.Columns>

                <DataGridTextColumn Binding="{Binding Path=S1}" />
            </DataGrid.Columns>

        </DataGrid>

    </Grid>
</Window>

The support for DesignInstance is great for the list box. It validates the use of the Children property, as well as the S1 property.

In the case of  DataGrid, it seems to handle either the grid itself or its columns. When the data context is set at the window level, it validates the ItemsSource binding but chokes on the column.
If I set a design data context on the DataGrid, it validates the columns, but I get a warning on the ItemsSource property.

This happens on both Silverlight 4 and WPF 4.

I attach a sample project (don't run it, it does not do anything).

Regards,
Jean-Marie Pirelli



Attachment(s):
design_instance.zip
5 comments

I believe your problem highly relates to the issue http://youtrack.jetbrains.net/issue/RSRP-272732
We'll definitely fix it by 6.1 Release.
Thanks a lot for your feedback.

0

Yes, it seems to be the same problem.

Thanks,
Jean-Marie

0

I have the same problem and have a newer version of Resharper than 6.1.

So the problem is still there. Any suggestions?

0

What ReSharper version do you use? Please attach a screenshot of the issue.

Thanks!  

0

I use Resharper Version Ultimate 2016.1.2.

Below see the used Code (XAML and CS).

The "Name" Property in the DataGridTextColumn is marked from Resharper

 

 

 

0

Please sign in to leave a comment.