vb.net - Cast(Of ?) from UIElement -


in silverlight custom controls in theuielementcollection of stackpanel. want list of them specific value. there divelements in container. returns nothing when know have 1 or more. know can make simple loop , cast types inline, want better linq , cast(of tresult). attempt @ casting:

dim mylist = trycast(spdivs.children.where(function(o) directcast(o, divelement).elementparent bcomm).cast(of divelement)(), list(of divelement)) 

the problem can't cast list(of divelement). collection uielementcollection, not list(of t).

you build new list, though. can simplified using oftype instead of casting manually:

dim mylist = spdivs.children.oftype(of divelement)()                             .where(function(o) o.elementparent bcomm)                             .tolist() 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -