Click here to Skip to main content
15,671,233 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How do I bind data in Textblock?
when I write data in textbox then press add button and it will be bind data in textblock using listview WPF MVVM ?

refer this link
Visit Question Its URL is
Updated 30-Dec-15 19:57pm

1 solution

Hi, this is simple, just create a List of string (List<string>). Bind the craeted List to ListBox's ItemsSource. And just add your textbox's input string to this List whenever you press the button, it will reflects in the listbox.
Share this answer
Dhawal Sojitra 31-Dec-15 1:32am    
can you go with step by step?
VR Karthikeyan 31-Dec-15 2:10am    
Sorry, I was wrong. Use Observable Collection of string (ObservableCollection<string>) instead List<string>, it works.
VR Karthikeyan 31-Dec-15 2:11am    
create property like,

private ObservableCollection<string> _StringList = new ObservableCollection<string>();

public ObservableCollection<string> StringList
get {return _StringList;}
set {_StringList=value; }

set ListBox's ItemsSource like,


Add TextBox's input string to the Observable Collection like (in button click event),


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