These are chat archives for JohanLarsson/Gu.Wpf.PropertyGrid

26th
Sep 2016
Arasn
@Arasn
Sep 26 2016 11:30
How can the Gritdline appear? from XAML Setting of Rows (BorderThickness="1") or in source?
Johan Larsson
@JohanLarsson
Sep 26 2016 11:31
do you want borders?
If so defining it in the style is probably best
Arasn
@Arasn
Sep 26 2016 11:32
yes, borders.
Arasn
@Arasn
Sep 26 2016 13:50
I stumbled over Undo/Save, is save puts: oldValue = newValue only?
Johan Larsson
@JohanLarsson
Sep 26 2016 13:54
yeah it is only for the demo
In a real app you want to write to disk in save then update oldvalue with a clone of editvalue
Arasn
@Arasn
Sep 26 2016 13:58
how to get current value of the row-item from ScalarValue or Value
Johan Larsson
@JohanLarsson
Sep 26 2016 13:59
not sure how you mean, typically you will bind it to the viewmodel
Arasn
@Arasn
Sep 26 2016 14:05
binding not working because I set different structurs at run time,
I am iterating Gu.Wpf.PropertyGrid.Rows (here StructureRow) to set:
foreach (var item in StructureRow.Items)
{
item.OldValue = GetCurrentValue(item);
}
Johan Larsson
@JohanLarsson
Sep 26 2016 14:07
should be item.SetCurrentValue(Row.OldValueProperty, item.Value) I think
setting oldvalue like you do will kill bindings
Arasn
@Arasn
Sep 26 2016 14:10
SetCurrentValue is not a member in item which is here ForceRow|LengthRow|PowerRow|BoolRow ..
Johan Larsson
@JohanLarsson
Sep 26 2016 14:10
Arasn
@Arasn
Sep 26 2016 14:27
Right, it need cast and also for Undo
item.SetCurrentValue(Row.ValueProperty, rowObject.OldValue);
Johan Larsson
@JohanLarsson
Sep 26 2016 14:28
should not need a cast
Arasn
@Arasn
Sep 26 2016 14:29
foreach (var item in StructureRow.Items)
{
if (item.GetType() == typeof(AngleRow))
{
var rowObject = new AngleRow();
rowObject = (AngleRow)item;
rowObject.SetCurrentValue(AngleRow.ValueProperty, rowObject.OldValue);
}
else if (item.GetType() == typeof(ForceRow))
{
var rowObject = new ForceRow();
rowObject = (ForceRow)item;
rowObject.SetCurrentValue(ForceRow.ValueProperty, rowObject.OldValue);
}
}
Thanks for your Tipp, will use it up to now.
Johan Larsson
@JohanLarsson
Sep 26 2016 14:30
you can put code in ``` to make it syntax highlighted in chat
Arasn
@Arasn
Sep 26 2016 14:41
Which flag is set when a value is not valid?
Johan Larsson
@JohanLarsson
Sep 26 2016 14:45
no flag, it is in the validationerrors in the control in the template
for unit rows it will probably be a DoubleBox
You should be able to get it via the attached property Scope.HasError()
Arasn
@Arasn
Sep 26 2016 15:11
Border can be set when you know with wich type or Attribute you have to do, I give my Row-Type at runtime.
what is the use of IsDirty flag?
Johan Larsson
@JohanLarsson
Sep 26 2016 15:12
IsDirty is true when OldValue != Value