如何在wp7中更改列表框项目的可见性属性?例如:有一个列表框:HowtoprogrammaticallychangetheVisibilitypropertyofTextBlocks?ListBox为每个项目生成一个ListBoxItem类型的容器。您可以像这样访问它:ListBoxItemlbi=lb.ItemContainerGenerator.ContainerFromIndex(0)asListBoxItemlbi.Visibility=Visibility.Collapsed;如果要访问TextBlock,则需要浏览ListBoxItem的可视化树。比如使用LinqtoVisualTree:以上是C#学习教程:Howtochangethevisibilitypropertyofalistboxiteminwp7?如果分享的内容对你有用,需要进一步了解C#学习教程,希望大家多多关注——TextBlocktxt=lbi.Descendants().Single()asTextBlock;本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处:
