c# - Access WPF object by string variable -


i have x listviews in xaml form:

  • name: lvext1
  • name: lvext2
  • etc...

in program can access them directly lvext1.items or similar.

i access within function has number parameter

something like:

privat void accesslistview(string number){     return lvlext"number".items; } 

in symfony (php) can this: https://stackoverflow.com/a/31142123/1092632

i realize may different, express trying do.

two ways:

  1. use way wpf provided:

    var lvlext = this.findname("lvlext" + number) listview;

    var lvlext = logicaltreehelper.findlogicalnode(this, "lvlext" + number);

  2. use array reference:

    var lvlexts = new listview[3];

    ...

    var lvlext =listview[number];


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -