Sunday, April 17, 2011

How to get intellisense when doing XAML data bindings?

It would be nice if in XAML when I define ItemsControl/ItemsSource="{Binding AvailableContracts}" that Visual Studio would be smart enough to go find the property AvailableContracts on the ModelView which the DataContext is bound to, reflect it, and then when I type:

<TextBlock Text="{Binding Path=

it would pop up intellisense of the bindable properties that are available to me in my ContractModelView since AvailableContracts is a List collection.

I don't see why Visual Studio can't go follow this logical path and give me the needed intellisense. Can anyone explain what the disconnect here is? Or surely there is some way to "give it some help" so that it could provide intellisense. Any third-party tools to do this? Perhaps in VS2010? I hear MEF is going to make intellisense much better in VS2010, hope so.

This lack of databinding intellisense when writing my XAML views just feels like notepad. :-(

<UserControl 
    x:Class="TestMvvmWpf8898.Views.CustomerView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid>
        <StackPanel>
            <TextBlock Text="{Binding Path=FullName}"/>
            <ItemsControl ItemsSource="{Binding Path=AvailableContracts}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Path=NEED_INTELLISENSE_HERE
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </StackPanel>
    </Grid>
</UserControl>
From stackoverflow
  • there is only one good solution for your problem: Resharper

0 comments:

Post a Comment