0
我要訪問內部列表視圖命名控制datatemplet我也跟着這樣:How to Access a Named Control Inside a XAML DataTemplate (using CSharp訪問控制DataTemplete
itemlistview.ItemsSource=new List<MyObject>();
foreach (var item in itemListView.Items)
{
var _Container = itemListView.ItemContainerGenerator
.ContainerFromItem(item);
var _Children = AllChildren(_Container);
var _FirstName = _Children.OfType<StackPanel>()
.First(x => x.Name.Equals("subjectListItem"));
_FirstName.Visibility =
Visibility.Collapsed;
}
但var item in itemListView.Items
問題它retruns我傳遞給不ListView控件的ItemsSource的datatemplete內CONTROLES的爲MyObject 。 那麼如何返回控件?