if
(e.Row
is
GridViewNewRow)
{
ScrollIntoView(grdDataGrid, e.Row.Item);
}
private
void
ScrollIntoView(RadGridView grd,
object
itmSel)
{
grd.SelectedItem = itmSel;
grd.ScrollIntoViewAsync(grd.SelectedItem, r =>
{
var row = r
as
GridViewRow;
if
(row !=
null
)
{
row.IsCurrent =
true
;
row.IsSelected =
true
;
row.Focus();
}
grd.CurrentItem = itmSel;
grd.CurrentCellInfo =
new
GridViewCellInfo(grd.SelectedItem, grd.Columns[0]);
});
}
<
telerik:RadChart
Name
=
"MonitoringChart"
/>
private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
MonitoringChart.SeriesMappings.Clear();
var lineSeriesDefinition = new LineSeriesDefinition();
lineSeriesDefinition.ShowItemLabels = true;
lineSeriesDefinition.ShowItemToolTips = true;
lineSeriesDefinition.ItemToolTipFormat = "#Y at #X{dd-MMM-yy HH:mm:ss}";
lineSeriesDefinition.AxisName = item.Name;
var items = new List<
DataPoint
<object>>();
items.Add(new DataPoint<
object
>() { Time = DateTime.Now.AddMinutes(0), Value = 1 });
items.Add(new DataPoint<
object
>() { Time = DateTime.Now.AddMinutes(1), Value = 2 });
items.Add(new DataPoint<
object
>() { Time = DateTime.Now.AddMinutes(2), Value = 3 });
items.Add(new DataPoint<
object
>() { Time = DateTime.Now.AddMinutes(3), Value = 4 });
var seriesMapping = new SeriesMapping();
seriesMapping.ItemsSource = items; //item.Values;
seriesMapping.LegendLabel = item.Name;
seriesMapping.SeriesDefinition = lineSeriesDefinition;
seriesMapping.ItemMappings.Add(new ItemMapping() { FieldName = "Time", DataPointMember = DataPointMember.XValue
});
seriesMapping.ItemMappings.Add(new ItemMapping() { FieldName = "Value", DataPointMember = DataPointMember.YValue });
MonitoringChart.SeriesMappings.Add(seriesMapping);
}
public class DataPoint<
T
>
{
public DataPoint()
{
}
public DataPoint(T value, DateTime time)
{
Value = value;
Time = time;
}
public T Value { get; set; }
public DateTime Time { get; set; }
}
<
DataTemplate x:Key="RowItemDataTemplate">
<CheckBox x:Name="rowCheckbox" Margin="2,2"
Command="{Binding Path=DataContext.RowCheckCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}}"
Content="{Binding Path=RowName}"
IsChecked="{Binding Path=IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</DataTemplate>
<
ComboBox Grid.Row="0" Grid.Column="2" x:Name="cboRows" Style="{DynamicResource ValidatingComboBox}"
ItemsSource="{Binding RowItems}"
ItemTemplate="{StaticResource RowItemDataTemplate}"
Text="{Binding SelectedRowsText}"
IsEditable="True" Margin="5,0,0,0"
IsReadOnly="True"
MaxDropDownHeight="140"/>
public
ICommand RowCheckCommand
{
get
{
if (_rowCheckCommand == null)
{
_rowCheckCommand =
new RelayCommand(
param => RowCheckBoxChanged(),
param =>
true
);
}
return _rowCheckCommand;
}
}
public
void RowCheckBoxChanged()
{
NotifySelectedRowsText();
}
var headerStyle =
new
Style(
typeof
(GridViewHeaderCell));
headerStyle.Setters.Add(
new
Setter(GridViewHeaderCell.ToolTipProperty,
new
Binding(
"HeaderToolTip"
) { Source = columnModel }));
column.HeaderCellStyle = headerStyle;