示例#1
0
文件: Shell.xaml.cs 项目: kazo0/Dexr
        private void CurrentPage_Loaded(object sender, RoutedEventArgs e)
        {
            //Set Appbar visibility
            MainCommandBar.Visibility = currentPage.RequiresAppBar ?
                                        Visibility.Visible : Visibility.Collapsed;

            //Set title binding
            var binding = new Binding()
            {
                Path = new PropertyPath("Title"), Source = currentPage
            };

            PageTitle.SetBinding(TextBlock.TextProperty, binding);

            //Set Application Bar Buttons
            commandsBar.Items.Clear();
            var commands = currentPage.Commands ?? new CommandsCollection();

            foreach (var item in commands)
            {
                commandsBar.Items.Add(item);
                item.DataContext = currentPage.DataContext;
            }

            currentPage.Loaded -= CurrentPage_Loaded;
        }
 public TitlePanelControl()
 {
     InitializeComponent();
     PageTitle.SetBinding(TextBlock.TextProperty, new Binding()
     {
         Source = this, Path = new PropertyPath("TitleText")
     });
 }