SilverLight Binding

SilverLight Binding

Old forum URL: forums.lhotka.net/forums/t/7320.aspx


SouthSpawn posted on Wednesday, July 22, 2009

I am doing the following simple code just to test my ReadOnlyList Object.

<csla:CslaDataProvider 
         
x:Key="reportData"
         
ObjectType="MyAssembly.TestClass, MyAssembly"
         
ManageObjectLifetime="True"
         
FactoryMethod="GetListingRO"
         
DataChangedHandler="{StaticResource DataErrorDialog}"
         
IsInitialLoadEnabled="True">

         <
csla:CslaDataProvider.FactoryParameters>
               
<s:Int32>2</s:Int32>
         
</csla:CslaDataProvider.FactoryParameters>
</csla:CslaDataProvider>

<ItemsControl ItemsSource="{Binding Source={StaticResource reportData}, Path=Data}" Canvas.Top="300">

<TextBlock Text="{Binding Description}" FontSize="20" />

</ItemsControl>

When I run the project.
It prints
"TestClass, MyAssembly"

on the screen for each item it returns back instead of it's value.

It's display the namespace + class name on the screen.

Also, what is the Path=Data part for?

Any thoughts

RockfordLhotka replied on Wednesday, July 22, 2009

I haven't used ItemsControl, but I suspect it is like ListBox? With ListBox you need to provide a data template that describes how each item in the list is rendered, and I'm guessing ItemsControl works in a similar manner?

It sure sounds like it is currently just rendering the ToString() value for each item in the collection, which is what you'd get with a ListBox that didn't have a data template.

Copyright (c) Marimer LLC