or
[TestMethod]
public
void
TestMethod()
{
// find app window
var cond =
new
PropertyCondition(AutomationElement.NameProperty,
"MainWindow"
);
AutomationElement foundWindow = AutomationElement.RootElement.FindFirst(TreeScope.Children, cond);
// find tab control
cond =
new
PropertyCondition(AutomationElement.ControlTypeProperty, System.Windows.Automation.ControlType.Tab);
AutomationElement foundTab = foundWindow.FindFirst(TreeScope.Subtree, cond);
var tabCtl = (WpfTabList)UITestControlFactory.FromNativeElement(foundTab,
"UIA"
);
foreach
(var tab
in
tabCtl.Tabs)
{
var elements =
""
;
Mouse.Click(tab);
// do something to controls,
// for example collect their names
foreach
(var el
in
Walk(tab.NativeElement
as
AutomationElement))
{
elements +=
string
.Format(
"Name: '{0}', Type: '{1}'\n"
, el.Current.Name, el.Current.ControlType.ProgrammaticName);
}
MessageBox.Show(elements);
}
}
// Recursively walk an automation tree
private
List<AutomationElement> Walk(AutomationElement current)
{
var res =
new
List<AutomationElement>();
if
(current !=
null
)
{
res.Add(current);
res.AddRange(Walk(TreeWalker.RawViewWalker.GetFirstChild(current)));
res.AddRange(Walk(TreeWalker.RawViewWalker.GetNextSibling(current)));
}
return
res;
}
<
tel:MapLine
StrokeThickness
=
"5"
Stroke
=
"Red"
Point1
=
"{Binding MyViewModel.
Point1}"
Point2
=
"{Binding MyViewModel.
Point2}"
ToolTip
=
"{Binding MyViewModel.ItemName}"
/>
<
tel:MapLine
StrokeThickness
=
"5"
Point1
=
"{Binding MyViewModel.
Point1}"
Point2
=
"{Binding MyViewModel.
Point2}"
>
<
tel:MapLine.Stroke
>
<
SolidColorBrush
Color
=
"Red"
/>
</
tel:MapLine.Stroke
>
<
tel:MapLine.ToolTip
>
<
TextBlock
Text
=
"{Binding MyViewModel.ItemName}"
/>
</
tel:MapLine.ToolTip
>
</
tel:MapLine
>
<
tel:MapRectangle
Location
=
"{Binding Location}"
/>
public
class
FooViewModel : ViewModelBase
{
private
ObservableCollection<Foo> _fooCollection;
private
Foo _selectedFoo;
private
ICommand _addCommand;
public
ObservableCollection<Foo> FooCollection
{
get
{
return
_fooCollection; }
set
{
_fooCollection = value;
OnPropertyChanged(
"FooCollection"
);
}
}
public
Foo SelectedFoo
{
get
{
return
_selectedFoo; }
set
{
_selectedFoo = value;
OnPropertyChanged(
"SelectedFoo"
);
}
}
public
ICommand AddCommand
{
get
{
return
_addCommand ?? (_addCommand =
new
RelayCommand(i=>
this
.AddCommandMethod())); }
}
private
void
AddCommandMethod()
{
//Add item to collection
//Add item to SelectedFoo
}
<
telerik:RadCartesianChart
>
<
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:DateTimeCategoricalAxis
LabelFitMode
=
"None"
LabelFormat
=
"H"
DateTimeComponent
=
"Hour"
/>
</
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:LinearAxis
/>
</
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:LineSeries
ItemsSource
=
"{Binding}"
CategoryBinding
=
"XValue"
ValueBinding
=
"YValue"
/>
</
telerik:RadCartesianChart
>
public
class
ChartData
{
public
DateTime XValue
{
get
;
set
;
}
public
Double YValue
{
get
;
set
;
}
}
List<ChartData> datas =
new
List<ChartData>();
for
(
int
i = 0; i < 23; i++)
{
datas.Add(
new
ChartData
{
XValue = DateTime.Today.AddHours(i),
YValue = i
});
}
DataContext = datas;
Hi!
I have a simple task to be done! I have to display a chart using <RadChart> (like one in attachment). It is a simple horizontal bar (I guess with two series STOPPED, ACTIVE). public class DLYChartPoint : LPDEntityStatus { #region Private string label; double value; long uniqueId; #endregion // other class structures }
public ObservableCollection<DLYChartPoint> TimeLineChart
<telerik:RadChart x:Name="timeLineChart" ItemsSource="{Binding TimeLineChart, Mode=TwoWay}"> <telerik:RadChart.DefaultView> <telerik:ChartDefaultView> <telerik:ChartDefaultView.ChartLegend> <telerik:ChartLegend Visibility="Collapsed" /> </telerik:ChartDefaultView.ChartLegend> </telerik:ChartDefaultView> </telerik:RadChart.DefaultView> <telerik:RadChart.SeriesMappings> <telerik:SeriesMapping> <telerik:SeriesMapping.SeriesDefinition> <telerik:HorizontalStackedBarSeriesDefinition ></telerik:HorizontalStackedBarSeriesDefinition> </telerik:SeriesMapping.SeriesDefinition> <telerik:SeriesMapping.ItemMappings> <telerik:ItemMapping DataPointMember="Label" FieldName="Value"></telerik:ItemMapping> <telerik:ItemMapping DataPointMember="YValue" FieldName="Value"></telerik:ItemMapping> <telerik:ItemMapping DataPointMember="XCategory" FieldName="Label"/> </telerik:SeriesMapping.ItemMappings> </telerik:SeriesMapping> </telerik:RadChart.SeriesMappings> </telerik:RadChart>