Click here to Skip to main content
15,919,422 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is the code:

XML
<ListView ItemsSource="{Binding UsageProfilesList}" Grid.Row="1" HorizontalAlignment="Stretch" x:Name="usageProfileLists" >
                   <ListView.ItemTemplate>
                       <DataTemplate>
                           <Border Margin="0,10,0,10" PreviewMouseLeftButtonDown="Start" PreviewMouseMove="Drag" HorizontalAlignment="Stretch"
                                   MouseLeftButtonDown="AddItemToTimeline" Tag="{Binding}" Background="Transparent">
                               <TextBlock Text="{Binding Name}" FontSize="18" HorizontalAlignment="Center" />
                           </Border>
                       </DataTemplate>
                   </ListView.ItemTemplate>
               </ListView>



the binding of the list is not working, but i am showing a message box showing the list details and the list is getting filled.
what do i have wrong? I've spent hours trying to debug it but everything is working. the binding just seem to be ignored.
please help
Posted
Updated 27-Jul-11 22:28pm
v2

Hi,

Add
MIDL
DisplayMemberBinding="{Binding UserName}"  />
tag.
 
Share this answer
 
Comments
adnama 28-Jul-11 5:06am    
where do i add this?
Hi,

You need to specify the TargetType of your DataTemplate like so:

<DataTemplate DataType="{x:Type UsageProfilesList}">


The compiler doesn't know that "Name" is a property of "UsageProfilesList" otherwise.

Hope that helps :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900