Edit specific listview item in C# WPF -


is possible edit specific listview item @ runtime?

for (int = 0; < listviewservers.items.count; i++) {    if ( listviewservers.items[i].columnname == "my column name")         {            listviewservers.items[i].columnname.data = "new cell text";         } } 

yes, there way. should it? no. in wpf, should use data binding bind controls actual data, then, if right, can change data , ui update automatically. if not doing fancy graphics or interactions, code-behind (*.xaml.cs) should have no code apart autogenerated constructor , should not access controls c# code.

i suggest reading on data binding , mvvm pattern, example here, here or here.

that said, can access listview items, have know you're putting items collection or in itemssource (controls via xaml? controls via code? viewmodel classes datatemplates?). when know this, can do:

foreach (yourclass obj in listviewservers.items.oftype<yourclass>()) {   //do stuff obj } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -