views:

6270

answers:

2

I have this:

<ListBox x:Name="PART_lstAttributes" Grid.Row="1" Style="{StaticResource GlossyBlackListBox}">
  <ListBox.ItemTemplate>
    <DataTemplate>
       <StackPanel>
          <TextBlock x:Name="txtAttributeName" Text="{Binding AttributeName}"></TextBlock>
       </StackPanel>
    </DataTemplate>                                
  </ListBox.ItemTemplate>
</ListBox>

Note that this one is binding to the "AttributeName" property of my collection. What I'd like to be able to do is programmatically change "AttributeName" to something else. Is this possible?

+1  A: 

the following solution will work with out a property explicitly binding, Assuming that your Data item is a string or ToString enabled.

 <DataTemplate>
   <StackPanel>
      <TextBlock x:Name="txtAttributeName" Text="{Binding}"></TextBlock>
   </StackPanel>
</DataTemplate>
Jobi Joy
A: 

You could start by looking at that:

http://msdn.microsoft.com/en-us/library/system.windows.data.binding(VS.95).aspx

devMomentum