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
545
How to bind XamNumericEditor.ValueConstraint in a XamDataGrid Field
posted

I want to be able to change the ValueConstraint of a Field's numeric editor by binding to a property on the record's data context. This is my XAML: 

<igWPF:Field Name="VarianceValue" Label="Variance">
   <igWPF:Field.Settings>
     <igWPF:FieldSettings LabelPresenterStyle="{StaticResource VarianceTooltipHeaderStyle}"
                                    EditorType="{x:Type igWPF:XamNumericEditor}">
       <igWPF:FieldSettings.EditorStyle>
         <Style TargetType="{x:Type igWPF:XamNumericEditor}">
           <Setter Property="ValueConstraint">
             <Setter.Value>
               <MultiBinding Converter="{StaticResource constraintConverter}">
                 <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="MinConstraint" />
                 <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="MaxConstraint" />
               </MultiBinding>
             </Setter.Value>
           </Setter>
         </Style>
       </igWPF:FieldSettings.EditorStyle>
     </igWPF:FieldSettings>
   </igWPF:Field.Settings>
</igWPF:Field>

The 'MinConstraint' and 'MaxConstraint' are on the same object as the 'VarianceValue' property the field binds to.

- Atle