0

I have the following code for my textbox

<TextBox
    ....>
  <TextBox.Text>
    <Binding Path="Latitude" UpdateSourceTrigger="PropertyChanged">
      <Binding.ValidationRules>
        <c:LatitudeValidator>
      </Binding.ValidationRules>
    </Binding>
  </TextBox.Text>
</Text>

But I need an ISession property (of the View) to be passed to the property of the validation rule

  • Here is good sample https://stackoverflow.com/questions/46519802/how-to-bind-values-from-xaml-to-validation-rule – Lana Jan 07 '21 at 19:42
  • That works fine for pre-defined values, but what if in validation I need access to the actual "model". This works for my original question because ISession is pretty generic, but on validation of other fields, I need to access the Model. – John Grove Jan 07 '21 at 20:35
  • It works for non constant values good. For predefined values there is simpler way with Dependence Property in the rule. Wrapper let you pass whatever you want. I used this way for checking with comparison two viewmodel’s properties. – Lana Jan 08 '21 at 07:11
  • Look at acceptable answer in that question sample with wrapper. – Lana Jan 08 '21 at 07:15

0 Answers0