Hi
I tried to set the AutoFillDate Property for a xamDateTimeEditor in my XamDataGrid.
I tried like this:
<Window.Resources>
<Style TargetType="{x:Type igDE:XamDateTimeEditor}"> <Setter Property="AutoFillDate" Value="Year" /> </Style>
</Window.Resources>
But I get : "Invalid PropertyDescriptor Value"
what am I doing wrong?
It looks like the problem is that this property was defined as a CLR property only and not as a DependencyProperty. I have submitted an issue for this and will get a case created for you so you can be notified when this is fixed. In the interim you will need to set this locally on the element instance (in xaml or code).
Thank you for the answer,
how can I set the Value locally. I don't have an element instance. It is a Field in a xamDataGrid where I set the EditorType:
<igDP:Field Name="RB_Date" Label="Datum"> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igDE:XamDateTimeEditor}" EditorStyle="{StaticResource DateTimeEditorStyle}" /> </igDP:Field.Settings> </igDP:Field>
Sorry I didn't realize you were doing this in the grid although I suppose I should have assumed that based on the forum. Since this property only affects editing, one thing you could do is to handle the EditModeStarted and then if e.Editor is an xamDateTimeEditor you could upcast to this type and set that property on the editor instance.
Thank you for your fast answer,
your solution doesn't work for me because I have set the EditorStyle in my Field and set the TargetType to ValueEditor.
<Style x:Key="DateTimeEditorStyle" TargetType="{x:Type igDE:ValueEditor}" />
I need this to set the Min and Max Value for the DateTime Edior. I'm doing this in the CodeBehind like this:
Style s = (Style)FindResource("DateTimeEditorStyle"); ValueConstraint constraint = new ValueConstraint(); constraint.MaxInclusive = DateTime.Now.Date; constraint.MinExclusive = _Akt_RKAbschluss.Date; Setter st = new Setter(XamDateTimeEditor.ValueConstraintProperty, constraint); s.Setters.Add(st);
So I would need to set 2 differnt EditorStyles to one Field. Is there any posiblity to track the Event for me.
I'm not sure I follow. I'm not advocating not using an EditorStyle - just that until this issue is resolved you cannot set the AutoFillDate property in the style for the masked editor. You can still set the EditorStyle and set other properties as you would have. For any cell in whatever Field you would have wanted to set the AutoFillDate property for the xamDateTimeEditor you would set the property on the xamDateEditor instance itself within the EditModeStarted event as I mentioned in my previous post. In that event you have access to the Cell (and therefore its Field) and the Editor instances. Setting this one property in this event has no bearing on where the Style for that editor instance came from. I was just proposing this as a temporary workaround until a hotfix that includes this fix is available - at which point you would receive an email notification of the availability of the hotfix.
Thank you,
Sorry, I have misunderstod your first postl. The Workarround works.