private
void
SetupGraph()
{
radChart.ItemsSource = dataContext.Points;
var seriesMappings = CreateSeriesMappings();
var axisX =
new
AxisX
{
DefaultLabelFormat =
"dd-MM-yy"
,
LabelRotationAngle = 45,
Step = 1,
LabelStep = 1,
AutoRange =
false
,
IsDateTime =
true
};
var tickPoints = dataContext.Points.SelectMany(gp => gp).Select(gp => gp.Date).Distinct().Select(dt =>
new
TickPoint(){IsDateTime =
true
, Label = dt.ToShortDateString(), Value = dt.ToOADate()});
axisX.TickPoints.AddRange(tickPoints);
var axisY =
new
AxisY { DefaultLabelFormat =
"N3"
, };
var chartArea =
new
ChartArea { AxisX = axisX, AxisY = axisY, LegendName =
"legend"
};
var chartLegend =
new
ChartLegend { Name =
"legend"
, UseAutoGeneratedItems =
true
, Width = 145 };
var chartTitle =
new
ChartTitle { Content =
"Graph"
};
var chartDefaultView =
new
ChartDefaultView
{
ChartArea = chartArea,
ChartTitle = chartTitle,
ChartLegend = chartLegend,
};
radChart.SeriesMappings.AddRange(seriesMappings);
radChart.DefaultView = chartDefaultView;
radChart.AnimationSettings =
new
AnimationSettings() { TotalSeriesAnimationDuration =
new
TimeSpan(0, 0, 0, 00), ItemAnimationDuration =
new
TimeSpan(0,0,0,0), ItemDelay =
new
TimeSpan(0,0,0,0)};
radChart.Rebind();
}
Hello
Is there property can user edit row?
Best regards
Ehud
public
class TestClass : INotifyDataErrorInfo
{
int code;
public int Code
{
get {return code; }
set
{
IsCodeValid(value);
if (code != value) code = value;
}
}
string name;
public string Name
{
get {return name; }
set {name = value; }
}
public bool IsCodeValid(int value)
{
bool isValid = true;
if (value == 0)
{
AddError("Code", "Code Err!", false);
isValid = false;
}
else RemoveError("Code", "Code Err!");
return isValid;
}
private Dictionary<String, List<String>> errors = new Dictionary<string, List<string>>();
public void AddError(string propertyName, string error, bool isWarning)
{
if (!errors.ContainsKey(propertyName))
errors[propertyName] = new List<string>();
if (!errors[propertyName].Contains(error))
{
if (isWarning) errors[propertyName].Add(error);
else errors[propertyName].Insert(0, error);
RaiseErrorsChanged(propertyName);
}
}
public void RemoveError(string propertyName, string error)
{
if (errors.ContainsKey(propertyName) && errors[propertyName].Contains(error))
{
errors[propertyName].Remove(error);
if (errors[propertyName].Count == 0) errors.Remove(propertyName);
RaiseErrorsChanged(propertyName);
}
}
public void RaiseErrorsChanged(string propertyName)
{
if (ErrorsChanged != null)
ErrorsChanged(this, new DataErrorsChangedEventArgs(propertyName));
}
#region
INotifyDataErrorInfo Members
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;
public System.Collections.IEnumerable GetErrors(string propertyName)
{
if (String.IsNullOrEmpty(propertyName) || !errors.ContainsKey(propertyName))
return null;
return errors[propertyName];
}
public bool HasErrors
{
get { return errors.Count > 0; }
}
#endregion
}
<telerik:RadGridView Name="radGridView1" AutoGenerateColumns="False" ItemsSource="{Binding ColData}" >
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Code" DataMemberBinding="{Binding Code}" ValidatesOnDataErrors="Default" />
<telerik:GridViewDataColumn Header="Name" DataMemberBinding="{Binding Name}" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
Hi,
I am using RadGridView in a desktop WPF application. The ItemsSource property of the grid is set to an instance of QueryableCollectionView. What I need is to hook to an event that is raised whenever the user tries to select a different row in the grid and then be able to cancel the change, depending on some user input. I tried using the CurrentChanging event of the QueryableCollectionView and set “e.Cancel = true”. As this approach works just fine with a normal WPF ListView, RadGridView doesn’t pick up the result from the CurrentChanging event of the QueryableCollectionView and the selection of the RadGridView is still moved to the new row (although the CollectionView’s current item does not change!). Can you give me a solution? Thank you!
ElementExported event.