Hello, I'm creating a Loading Adorner that has a swirling icon over it. I tried binding the visibility property directly in the XAML but that actually hides everything inside its hierarchy.
I have this in my XAML:
<AdornerDecorator Visibility="{Binding Path=RootGroup.Loading, Converter={StaticResource VisibilityConverter}}">
<TreeView x:Name="groupTreeView" />
</AdornerDecorator>
and this in my constructor
LoadingAdorner adorner = new LoadingAdorner(groupTreeView);
AdornerLayer.GetAdornerLayer(groupTreeView).Add(adorner);
This isn't want I wanted so I tried binding it in the code instead:
LoadingAdorner adorner = new LoadingAdorner(groupTreeView);
Binding bind = new Binding("RootGroup.Loading");
bind.Source = this.DataContext;
bind.Converter = new VisibilityConverter();
adorner.SetBinding(LoadingAdorner.VisibilityProperty, bind);
AdornerLayer.GetAdornerLayer(groupTreeView).Add(adorner);
This will work if the DataContext is not null because it can actually find RootGroup.Loading. But if it is null then the binding has no source to look at.
So I was wondering what does the XAML databinding use as its .Source ? Binding directly in the XAML binds to the correct property, but it doesn't achieve the same result. So I'm just wondering what I should be setting my .Source to So i can bind to RootGroup.Loading ?
Thanks, Raul