开发者

get RibbonCommand Name from sender Object that is executed

How to get the Label of Ribbon command that is executed. Information is present in sender object but how to cast it in RibbonCommand and then I can get that command name

 private void RibbonCommand_Executed(object sender, ExecutedRoutedEventArgs e)
    {
RibbonCommand rbnCmd = sender as RibbonCommand;
}

But in this case r开发者_C百科bnBmd remains empty. How to cast sender object into ribbon command ?


Here You Go Man

  private void RibbonCommand_Executed(object sender, ExecutedRoutedEventArgs e)
    {
        MainWindow m = (MainWindow)sender;
        RibbonGroup rbnGrp = m.DiscoveryGroup;
        RibbonCommand rbnCmd = (RibbonCommand)rbnGrp.Command;
        string clickedCmd = rbnCmd.LabelTitle;

MainWindow is your class that extends Window means MainWindow:Window formally your Window1

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜