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
1285
Using ValueConstraint to validate control with OneWay Binding
posted

I have a requirement to show a red border around editor control when value does not equal a certain value (obtained from another object). The controls value is bind to a column in a dataRow. I tried using ValueConstraint and setting FixedValue to the value it should be. This control will not be able to change the value to the correct hence oneway binding and set to readOnly. If I recall correctly there was a way to show a red box around control using IDataErrorInfo.

<ig:XamCurrencyEditor Grid.Row="1" Grid.Column="1" Name="awardAmt"  Value="{Binding Path=[numJobBudget]}" IsReadOnly="True" Theme="[current]"/>

Any ideas?

Parents
No Data
Reply
  • 35319
    Verified Answer
    posted

    Hello,

     

    Thank you for your post. I have been looking into your question and the easiest way to achieve the desired functionality is to change the ‘BorderBrush’ property of the XamCurrencyEditor on ‘Loaded’ event of its value is different from the desired one like e.g. :

     

       private void editor_Loaded(object sender, RoutedEventArgs e)

            {

                if ((sender as XamCurrencyEditor).Text != "$10.00")

                {

                    (sender as XamCurrencyEditor).BorderBrush = Brushes.Red;

                }

            }

     

    Let me know, if you need any further assistance on this matter.

Children