public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container) { var viewer = container.GetParent<ExpressionViewer>(); var rvExp = item as RightValueExpression; Debug.Assert(viewer != null); Debug.Assert(rvExp != null); if (((ComparisionExpression)rvExp.Parent).Left.Value != null) { if (((ComparisionExpression)rvExp.Parent).Left.Value.ToString() == "Gender") { return (DataTemplate)viewer.Resources["DT_ComboBox"]; } return (DataTemplate)viewer.Resources["DT_Text"]; } return (DataTemplate)viewer.Resources["DT_Empty"]; }
private string getCodeFromAutomationElement( AutomationElement element, System.Windows.Automation.TreeWalker walker) { string result = string.Empty; string elementControlType = element.Current.ControlType.ProgrammaticName.Substring( element.Current.ControlType.ProgrammaticName.IndexOf('.') + 1); // in case this element is an upper-level Pane // residing directrly under the RootElement // change type to window // i.e. Get-UIAPane - > Get-UIAWindow // since Get-UIAPane is unable to get something more than // a window's child pane control if (elementControlType == "Pane" || elementControlType == "Menu") { if (walker.GetParent(element) == AutomationElement.RootElement) { elementControlType = "Window"; } } string elementVerbosity = @"Get-UIA" + elementControlType; try { if (element.Current.AutomationId.Length > 0) { elementVerbosity += (" -AutomationId '" + element.Current.AutomationId + "'"); } } catch { } try { if (element.Current.ClassName.Length > 0) { elementVerbosity += (" -Class '" + element.Current.ClassName + "'"); } } catch { } try { if (element.Current.Name.Length > 0) { elementVerbosity += (" -Name '" + element.Current.Name + "'"); } } catch { } result = elementVerbosity; return result; }