Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
105
ValueContraint DateTime in XamDataGrid
posted

I have the following....


<igDP:FieldSettings

x:Key="PayDateFieldSettings" CellClickAction="SelectRecord"
AllowEdit="True"


LabelTextAlignment="Center"

LabelTextWrapping="WrapWithOverflow"

EditAsType="{x:Type System:DateTime}"

ExcelExporter:DataPresenterExcelExporter.ExcelLabelFormatSettings ="{StaticResource ExcelLabelSettings}"

ExcelExporter:DataPresenterExcelExporter.ExcelCellFormatSettings ="{StaticResource ExcelRightCellSettings}">

<igDP:FieldSettings.EditorStyle>

<Style TargetType="igEditors:XamDateTimeEditor">

<Setter Property="Format" Value="{x:Static Constants:DateTimeFormats.FormatDateShort}" />

<Setter Property="IsEnabled" Value="{Binding DataItem.HasEntitlement}"/>

<Setter Property="Background" Value="Transparent"></Setter>

<Setter Property="ValueConstraint">

<Setter.Value>

<igEditors:ValueConstraint MinInclusive="{Binding DataItem.ExDate.Value, Mode=OneWay}" />

</Setter.Value>


</Setter>

</Style>

</igDP:FieldSettings.EditorStyle>

<igDP:FieldSettings.CellValuePresenterStyle>

<Style TargetType="{x:Type igDP:CellValuePresenter}" BasedOn="{StaticResource CenterAlignedCellValuePresenterStyle}">

<Style.Triggers>

<MultiDataTrigger>

<MultiDataTrigger.Conditions>

<Condition Binding="{Binding DataItem.PayDate.IsValueOverriden}" Value="True" />
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>

<Setter Property="Background" Value="{DynamicResource CellOverrideBackground}" />
</MultiDataTrigger.Setters>

</MultiDataTrigger>

</Style.Triggers>

</Style>

</igDP:FieldSettings.CellValuePresenterStyle>

</igDP:FieldSettings>

 

and the field in the grid is


<igDP:UnboundField
 Binding="{Binding PayDate.Value, Mode=TwoWay,Converter={StaticResource _converterDate}}"
 Label="Pay Date"
 Settings="{StaticResource PayDateFieldSettings}">
 </igDP:UnboundField>

However I get the following error...

System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=DataItem.ExDate.Value; DataItem=null; target element is 'ValueConstraint' (HashCode=22098140); target property is 'MinInclusive' (type 'Object')