コード例 #1
0
ファイル: GridTasksPad.cs プロジェクト: pawels17/MUTDOD
        private void InitToolbars()
        {
            ToolBars = ExtensionService.Sort(toolBars);

            foreach (IToolBar toolBarViewModel in ToolBars)
            {
                ToolBar toolBar = new ToolBar();
                toolBar.DataContext = toolBarViewModel;

                // Bind the Header Property
                Binding headerBinding = new Binding("Header");
                toolBar.SetBinding(ToolBar.HeaderProperty, headerBinding);

                // Bind the Items Property
                Binding itemsBinding = new Binding("Items");
                toolBar.SetBinding(ToolBar.ItemsSourceProperty, itemsBinding);

                // Bind the Visible Property
                Binding visibleBinding = new Binding("Visible");
                visibleBinding.Converter = new BooleanToVisibilityConverter();
                toolBar.SetBinding(ToolBar.VisibilityProperty, visibleBinding);

                // Bind the ToolTip Property
                Binding toolTipBinding = new Binding("ToolTip");
                toolBar.SetBinding(ToolBar.ToolTipProperty, toolTipBinding);

                ToolBarTray.ToolBars.Add(toolBar);
            }
        }