启用功能区控制

时间:2009-10-20 08:38:43

标签: wpf ribbon

菜单项和所有其他菜单未启用``     xmlns:d =“http://schemas.microsoft.com/expression/blend/2008”xmlns:mc =“http://schemas.openxmlformats.org/markup-compatibility/2006”     的xmlns:图表= “CLR-名称空间:System.Windows.Controls.DataVisualization.Charting;装配= System.Windows.Controls.DataVisualization.Toolkit”
    X:类= “WpfApplication4.MainWindow”     的xmlns:WA = “CLR的命名空间:WpfApplication4”     Title =“Volume Net Dude”x:Name =“RibbonWindow”     图标= “图片\的icon.png”     Width =“795”mc:Ignorable =“d”WindowStartupLocation =“CenterScreen”WindowState =“Maximized”Closing =“Window_Closing”Closed =“Window_Closed”IsTabStop =“False”> `

<!--RibbonWindow Resource Dictionary-->
<r:RibbonWindow.Resources>
    <ResourceDictionary>

        <!--Ribbon Commands-->
        <r:RibbonCommand x:Key="cmdPrint" CanExecute="RibbonCommand_CanExecute_Print" LabelTitle="Print" LabelDescription="Print" ToolTipTitle="Help" ToolTipDescription="This is used to Print" SmallImageSource="Images\printIcon.png" LargeImageSource="Images\printIcon.png" />
        <r:RibbonCommand x:Key="cmdExit" CanExecute="RibbonCommand_CanExecute_Close" LabelTitle="Close" LabelDescription="Close" ToolTipTitle="Help" ToolTipDescription="Close Application" SmallImageSource="Images\exitIcon.png" LargeImageSource="Images\exitIcon.png" />
        <r:RibbonCommand x:Key="cmdHelp" CanExecute="RibbonCommand_CanExecute_Help" LabelTitle="About" LabelDescription="Help" ToolTipTitle="Help" ToolTipDescription="About Application" SmallImageSource="Images\ICON.png" LargeImageSource="Images\ICON.png" />

        <!--Theme-->
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Blue.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</r:RibbonWindow.Resources>

<!--Root Grid-->




    <DockPanel>     
    <r:Ribbon DockPanel.Dock="Top" Title="Volume Net Dude " x:Name="ribbon" BorderBrush="Orange">
        <r:Ribbon.SelectedTab>
            <r:RibbonTab/>
        </r:Ribbon.SelectedTab>

        <!--Quick Access Toolbar-->
        <r:Ribbon.QuickAccessToolBar>
            <r:RibbonQuickAccessToolBar>
                <r:RibbonButton Command="{StaticResource cmdExit}" />
                <r:RibbonButton Command="{StaticResource cmdPrint}" />
                <r:RibbonButton Command="{StaticResource cmdHelp}"/>
            </r:RibbonQuickAccessToolBar>
        </r:Ribbon.QuickAccessToolBar>

        <r:Ribbon.ApplicationMenu>                
            <r:RibbonApplicationMenu IsEnabled="True" >
              <r:RibbonApplicationMenu.Command>
                    <r:RibbonCommand Executed="RibbonCommand_Executed" SmallImageSource="Images\ICON.png" LargeImageSource="Images\ICON.png" />
                </r:RibbonApplicationMenu.Command>

                <r:RibbonApplicationMenuItem Command="{StaticResource cmdPrint}" />
                <r:RibbonApplicationMenuItem Command="{StaticResource cmdExit}" />
                <r:RibbonApplicationMenuItem Command="{StaticResource cmdHelp}" />

            </r:RibbonApplicationMenu>
        </r:Ribbon.ApplicationMenu>
        <r:RibbonTab x:Name="HomeTab" Label="Home" IsSelected="True">
            <r:RibbonGroup Name="FileGroup">
                <r:RibbonGroup.Command>
                    <r:RibbonCommand LabelTitle="Home" />
                </r:RibbonGroup.Command>
                <r:RibbonButton Name="menuExit" Content="Exit" Command="{StaticResource cmdExit}"/>
                <r:RibbonButton Name="menuPrint" Content="Print" Command="{StaticResource cmdPrint}"/>
            </r:RibbonGroup>
        </r:RibbonTab>
        <r:RibbonTab x:Name="HelpTab" Label="Help">
            <r:RibbonGroup Name="HelpGroup">
                <r:RibbonGroup.Command>
                    <r:RibbonCommand LabelTitle="Help" />
                </r:RibbonGroup.Command>

                <r:RibbonButton Name="menuAbout" Content="About" Command="{StaticResource cmdHelp}"/>
            </r:RibbonGroup>
        </r:RibbonTab>
    </r:Ribbon>

    <Grid Background="#FFE5F1FE">
    <TabControl x:Name="tabControlMain" Margin="1,0,0.1,0" Background="#FFFCFCFC">
    <TabItem Header="Tab Header # 1" Background="#FFDA0000">
                <Grid x:Name="GridMain" Margin="-5.333,-2.554,-3.767,-4.334" Background="Transparent">  
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>           
            </Grid.ColumnDefinitions>
                <!--[START] Epander for Tree View placed in Column 0 (the most left column) -->
                <Expander Grid.Column="0" x:Name="expanderViewBoxDisvoceredTreeNodes" IsExpanded="True" 
                        ExpandDirection="Left" HorizontalAlignment="Left" HorizontalContentAlignment="Left"
                        VerticalContentAlignment="Stretch" Width="193.333" Expanded="expanderViewBoxDisvoceredTreeNodes_Expanded" Collapsed="expanderViewBoxDisvoceredTreeNodes_Collapsed" Cursor="Arrow">
                    <TreeView IsEnabled="True" x:Name="discoveredNodes" Visibility="Visible" Margin="0,1" Width="173.333" Initialized="discoveredNodes_Initialized" MouseDoubleClick="discoveredNodes_MouseDoubleClick" Background="#FFE5F1FE" >
                        <TreeViewItem x:Name="discNodesTreVuItm" IsExpanded="True" Height="Auto" Width="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"/>                             

                    </TreeView>

                </Expander>

                <Grid Grid.Column="1">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="0.043*"/>
                        <RowDefinition Height="0.957*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <!--[Start] Charting Row 0-->               
                    <!--Viewbox Name="ChartViewbox" Grid.Row="0" Stretch="Uniform" -->

                    <!--chartingToolkit:Chart x:Name="mainChart" Grid.Row="0" Margin="0,8,8,8"  Title="Chart Title" Height="Auto" Width="Auto">
                    <chartingToolkit:Chart.DataContext>
                        <PointCollection>1,10 2,20 3,30 4,40</PointCollection>
                    </chartingToolkit:Chart.DataContext>
                    <chartingToolkit:ColumnSeries DependentValuePath="X" IndependentValuePath="Y" ItemsSource="{Binding}"/>
                </chartingToolkit:Chart-->

                <Grid Grid.RowSpan="2">

    <charting:Chart x:Name="mainChart" Grid.Row="0" Margin="0,8,8,8"  Title="Net Volume Usage" Height="Auto" Width="Auto" LegendTitle="Volume" Background="#FFE5F1FE"/>
    <Canvas HorizontalAlignment="Right" Margin="0,17,17,0" VerticalAlignment="Top" Width="25" Height="25">
        <WA:FrontEndWaiting Width="50" Height="50" x:Name="animatedIcon"
    RenderTransformOrigin="0.44,0.44" d:LayoutOverrides="HorizontalAlignment, VerticalAlignment, Width, Height" Canvas.Left="-25"/>
    </Canvas>

</Grid>



                    <Expander x:Name="expanderVolumeDataTable" Grid.Row="2" IsExpanded="True" ExpandDirection="Up" 
                              Collapsed="expanderVolumeDataTable_Collapsed" Expanded="expanderVolumeDataTable_Expanded" Header="" Margin="0,10,8,10" >

                            <Custom:DataGrid x:Name="dataGridRunningVolume" AlternationCount="2"  Margin="0,0,0,0" AutoGenerateColumns="True" ItemsSource="{Binding}" AlternatingRowBackground="#FFCDE1FC" BorderBrush="Black" RowBackground="#FFD8E8FC"/>

                        </Expander>         

                </Grid>



        </Grid>

    </TabItem>


</TabControl>
</Grid>
</DockPanel>

1 个答案:

答案 0 :(得分:0)

<r:RibbonWindow.Resources>
    <ResourceDictionary>

        <r:RibbonCommand Executed="RibbonCommand_Executed" x:Key="cmdPrint" LabelTitle="Print" LabelDescription="Print" ToolTipTitle="Help" ToolTipDescription="This is used to Print" SmallImageSource="Images\printIcon.png" LargeImageSource="Images\printIcon.png" />
        <r:RibbonCommand Executed="RibbonCommand_Executed_Exit" x:Key="cmdExit" LabelTitle="Close" LabelDescription="Close" ToolTipTitle="Help" ToolTipDescription="Close Application" SmallImageSource="Images\exitIcon.png" LargeImageSource="Images\exitIcon.png" />
        <r:RibbonCommand Executed="RibbonCommand_Executed" x:Key="cmdHelp" LabelTitle="About" LabelDescription="Help" ToolTipTitle="Help" ToolTipDescription="About Application" SmallImageSource="Images\vdiWorksIcon.png" LargeImageSource="Images\vdiWorksIcon.png" />
        <r:RibbonCommand x:Key="testCmd" Executed="RibbonCommand_Executed" LabelTitle="Test Command" ToolTipDescription="test command" SmallImageSource="Images\ICON.png" LargeImageSource="Images\ICON.png"/>

        <!--Theme-->
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Blue.xaml" />
        </ResourceDictionary.MergedDictionaries>

    </ResourceDictionary>
</r:RibbonWindow.Resources>

100%正确工作