Hi,
I'm using a XamChart in my application to show a little diagram, this chart isn't interactive (no legend, no changes, no rotate), is a simple pie chart 2D.
When navigate throw controls with TAB key, the chart capture de focus 4 times (i must hit TAB key 4 times to select next control). I changed "focusable" property for the chart and now "only" requiered 3 TABs to select next control.
How can I do a "non ficusable" chart?
Attach a little sample.
Thanks in advanced
if you want to make tab skip over the chart then execute this code, or change the default styles of the chart appropriately:
chart.IsTabStop = false; chart.Scene.IsTabStop = false; chart.Scene.GridArea.IsTabStop = false; chart.Legend.IsTabStop = false;
Hope this helps!
-Graham
Hi Graham,
I just test your solution and solved the problem partially. Now, there's only one control capturing the focus, this control is a unknown control (without name) of type "Infragistics.Windows.Chart.Chart".
How can I access to this control to disable TAB stop?
Thanks a lot
I'm not sure you can get at that control through any of the public properties. You may just want to traverse the Logical Tree using LogicalTreeHelper and set all the logical children (and their children, recursively) of XamChart to IsTabStop=false
Thanks, it works fine
Try this:
private void XamChart_Loaded(object sender, RoutedEventArgs e) { theChart.IsTabStop = false; foreach (var child in theChart.VisualChildren() .OfType() .Where((c) => c.IsTabStop)) { child.IsTabStop = false; } }
Given this:
public static class Helper { public static IEnumerable VisualChildren( this DependencyObject parent) { for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++) { var child = VisualTreeHelper.GetChild(parent, i); yield return child; foreach (var subChild in child.VisualChildren()) { yield return subChild; } } } }
I'm not sure to understand you..., I try to obtain the children collection from the chart, but it's empty.
I try this line, and the enumerator "childrens" has no elements:
System.Collections.
.GetChildren(chtSample).GetEnumerator();
Thanks for your help