Hello everyone.I try to make a tool (addon) whose button in main toolbar must be hidden on some conditions. Likepublic bool CanExecute(object parameter)
{
if(noData) {myButton.Visibility = Visibility.Collapsed; return false;}
myButton.Visibility = Visibility.Visible; return true;
}
but I can't find a way to define myButton object.Code likevar toolbar = MapApplication.Current.FindObjectInLayout("MainToolbarContainer") as ContentControl;
int childCount = VisualTreeHelper.GetChildrenCount(toolbar);
// for each child print details ...
doesn't show any buttons.How I can hide/show button in MainToolbar?