Hello,
with the XamOutlookBar I can use 'Add or remove Buttons' (found in the 'Cofigure Buttons' context menu) to control the visibility of the groups.
Does the XamOutlookBar expose some event that I could listen to, in order to react on hiding/showing groups?
What I want to achieve is the following: If the user hides the currently selected group, I want to automatically select the first visible group.
Thanks and best regards,
Rainer
Hi Rainer -
There is no event exposed by the XamOutlookBar that is raised when an OutlookBarGroup's Visibility is changed. However what you could do is override the metadata for the OutlookBarGroup's Visibility property and specify a PropertyChangedCallback. In there you coul have logic to determine if the currently selected group is being Collapsed and then select the group of your choice. Here is some sample code that shows how to do that:
// Static constructor of your app's main window.
{
// Override the property metadata for the OutlookBarGroup's Visibility property and specify a
// PropertyChangedCallback.
Infragistics.Windows.OutlookBar.
OutlookBarGroup.VisibilityProperty.OverrideMetadata(typeof(Infragistics.Windows.OutlookBar.OutlookBarGroup), new FrameworkPropertyMetadata(new PropertyChangedCallback
(OnVisibilityChanged)));
}
// This PropertyChangedCallback will be called whenever the Visibility property of an OutlookBarGroup changes
private static void OnVisibilityChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
OutlookBarGroup group = o as Infragistics.Windows.OutlookBar.OutlookBarGroup;
if (group != null)
// If the value being set is Visibility.Collapsed and it is being set on the selected group,
// select another group instead. (note that for simplicity in this code we are simply selecting the second group)
// Here we just select the second group, but you would add custom logic to
// determine which other group should be selected.
group.OutlookBar.Groups[1].IsSelected =
true;
Joe
Hello Joe,
thank you very much.
This solved my problem.
Best regards,