Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
460
Defaulting an OutlookBarGroup to selected from codebehind
posted

Hi,

 

I am adding groups in code behind and when I set the .IsSelected for a group, it is not the one selected when the bar completes loading.  Why is that.?  Here is the code to add the group

 

OutlookBarGroup xam = new OutlookBarGroup();
xam.Header = bg.BuddyGroupName.ToString();
if (grp.isDefault)
{
    xam.IsSelected = true;
    xam.Visibility = Visibility.Visible;
}
else
{
    xam.IsSelected = false;
}
ListBox lb = new ListBox();
lb.MouseDoubleClick += new MouseButtonEventHandler(lb_MouseDoubleClick);
foreach (string ct in grp.list)
{
    lb.Items.Add(ct.UserName.ToString());
    xam.Content = lb;
}
xamOutlookBar1.Groups.Add(xam);

  • 3071
    posted

    Try to add a group before setting IsSelected:

    OutlookBarGroup xam = new OutlookBarGroup();

    xamOutlookBar1.Groups.Add(xam);

    xam.Header = bg.BuddyGroupName.ToString();
    if (grp.isDefault)
    {
        xam.IsSelected = true;
        xam.Visibility = Visibility.Visible;
    }


    Hope this helps