Click here to Skip to main content
15,911,786 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello! How can i change Binding ,for example, by clicking a button?

Listbox
...

XML
<ListBox x:Name="dev_listbox" Background="#FF575652" BorderBrush="{x:Null}" GotFocus="dev_listbox_GotFocus" MouseDoubleClick="dev_listbox_MouseDoubleClick" >
<ListBox.ItemContainerStyle><Style TargetType="{x:Type ListBoxItem}"><Setter Property="Height" Value="26"  /></Style></ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate >
<Label Content="{Binding modificationTime,Converter={StaticResource formatter}}"/ >
..
..
</Listbox>


Is there anyway to save name of Binding which i want to use, for example, string bindingName = fileSize instead of modificationTime. So : <Label Content="{Binding bindingName>

Hope for your help.
Posted
Comments
Naz_Firdouse 8-Apr-14 6:04am    
in that case, you may need to create datatemplate in code behind

1 solution

Hi Elgars,

You need to bind the Content of the label in two-way mode. The items represented by the Data-Template should implement INotifyPropertyChanged.

When you want to change the Content of the label just change the value of the property that is binded to the label. Simple as that :)
 
Share this answer
 

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