public IDisposable AddAppBar(ReactiveAppBar appbar)
        {
            if (appbar == null)
            {
                throw new ArgumentNullException("appbar");
            }

            grid.Children.Add(appbar);
            this.Log().Info("Appbar {0} added.", appbar.GetHashCode());

            IDisposable dismiss = appbar.Opened.Merge(appbar.Closed).Subscribe(x => UpdateDismissLayerInteraction());
            return Disposable.Create(() =>
            {
                dismiss.Dispose();
                grid.Children.Remove(appbar);
                this.Log().Info("Appbar {0} removed.", appbar.GetHashCode());
                UpdateDismissLayerInteraction();
            });
        }
Example #2
0
 /// <summary>
 /// Called when the TopAppBar is changed.
 /// </summary>
 protected virtual void OnTopAppBarChanged(ReactiveAppBar oldTopAppBar, ReactiveAppBar newTopAppBar)
 {
     topAppBarDisposable.Dispose();
     if (oldTopAppBar != null)
     {
         oldTopAppBar.DataContext = null;
     }
     if (newTopAppBar != null)
     {
         newTopAppBar.PlacementMode = PlacementMode.Top;
         newTopAppBar.HorizontalAlignment = HorizontalAlignment.Stretch;
         newTopAppBar.VerticalAlignment = VerticalAlignment.Top;
         if (newTopAppBar.DataContext == null)
         {
             newTopAppBar.SetBinding(ReactiveAppBar.DataContextProperty, dataContextBinding);
         }
         if (areAppBarsregistered)
         {
             topAppBarDisposable = ReactiveAppBarManager.Instance.AddAppBar(newTopAppBar);
         }
     }
 }