I\'m trying to bind a TextBlock to a specific element in an ObservableCollection. This is what I do right now:
private ObservableCollection arr
you can use this way in my case I want to binding the visibility from an boolean array: code behind:
using System.Windows;
public static readonly DependencyProperty ButtonVisibleProperty =
DependencyProperty.Register("ButtonVisible", typeof(BindingList), typeof(BaseWindow), new PropertyMetadata(new BindingList()));
public BindingList ButtonVisible
{
get { return (BindingList)GetValue(BaseWindow.ButtonVisibleProperty); }
set
{
SetValue(BaseWindow.ButtonVisibleProperty, value);
OnPropertyChanged("ButtonVisible");
}
}
and in Xaml:
Visibility=""{Binding Path=ButtonVisible[0], RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
beware! the ancestorType depend of your Ancestor in my case is a window