WPF Web Based

WPF Examples

WPF

WPF Projects

WPF Project

adplus-dvertising
Adding Item Dynamically in Listview in Web Based
Previous Home Next
 private void button1_Click(object sender, RoutedEventArgs e)
{
    ListView1.Items.Add(textBox1.Text);
}

On button click event handler, we add the content of TextBox to the ListView by calling ListView.Items.Add method.

Now if you enter text in the TextBox and click Add Item button, it will add contents of the TextBox to the ListView.

Example:

Deleting ListView Items

The button click event handler looks like following. On this button click, we find the index of the selected item and call ListView.Items.RemoveAt method as following.

private void button2_Click(object sender, RoutedEventArgs e)
{ 
ListView1.Items.RemoveAt( ListView1.Items.IndexOf(ListView1.SelectedItem));
}

Example:

After press Delete Button it Will Delete From ListBox:

Previous Home Next
WPF Examples

WPF

WPF

WPF

WPF

WPF

WPF

WPF

WPF