views:

498

answers:

1

Hi. I have a WPF ListView and I bind it to a IEnumerable<T> collection. Everything works fine, but when I bind it to the IQueryable<T> collection, there are no items in list anymore.. Why? Is it not observable or what? When I look at the definition:

public interface IQueryable<T> : IEnumerable<T>, IQueryable, IEnumerable

and

public interface IEnumerable<T> : IEnumerable

so where is the problem?

A: 

It should work, as you correctly point out, these types are compatible. Turn on debugging in your binding and try it. Maybe the output will be a clue. It's likely something else besides the type you are binding to.

Anyway, here's the code. Put this in and watch your output window when your view loads. If it's Greek to you, just edit your post with the output from your output window.

 <Window …
    xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase"
    />

    <TextBlock Text="{Binding Path=Caption, diagnostics:PresentationTraceSources.TraceLevel=High}" … />
Anderson Imes