开发者

find child control by linq

开发者 https://www.devze.com 2023-03-09 01:02 出处:网络
this is the code to find ribbon control bool found = testRibbon.CommandTabs.Cast<RibbonTab>().Any(t => t.name == tab.Name);

this is the code to find ribbon control

bool found = testRibbon.CommandTabs.Cast<RibbonTab>().Any(t => t.name == tab.Name);

now how can i find by name a RadRibbonBarGroup that is member of RibbonTab

The scenario is like this: I have a ribbon control and i populate the tabs from modules inside tabs i add RadRibbonBarGroup and inside RadRibbonBarGroup i add RibbonButtons now to prevent duplicates i need to check if the tab exists and the ribonbargroup exist and has the button skip that tab and bargroup else add the button.. same should be for the tabs and bargroups. That is the fastest way to achive this scenario Can i do it via linq开发者_开发技巧 or should i iterate with for each witch is the best solution.


testRibbon.CommandTabs.Cast<RibbonTab>().Where(t => t.name == tab.Name)
                      .SelectMany(x => x.Groups.Where(g => g.Name == groupName));
0

精彩评论

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