Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <TextBox ToolTip="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}">
  2. <TextBox.Text>
  3. <Binding Path="ScriptFileMap" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
  4. <Binding.ValidationRules>
  5. <v:MinimumStringLengthRule MinimumLength="1" ErrorMessage="Map is required for saving." />
  6. </Binding.ValidationRules>
  7. </Binding>
  8. </TextBox.Text>
  9. </TextBox>
  10.  
  11. public void SaveScript()
  12. {
  13. if (this.ScriptFileName.Length > 0 && this.ScriptFileMap.Length > 0)
  14. {
  15. // save function logic
  16. }
  17. }
  18.  
  19. <TextBox Text="{Binding Path=ScriptFileName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" BorderBrush="{Binding Path=ScriptFileNameBorder, UpdateSourceTrigger=PropertyChanged}" ToolTip="{Binding Path=ScriptFileNameToolTip, UpdateSourceTrigger=PropertyChanged}" />
  20.  
  21. public string ScriptFileName
  22. {
  23. get
  24. {
  25. return this.scriptFileName;
  26. }
  27.  
  28. set
  29. {
  30. this.scriptFileName = value;
  31. RaisePropertyChanged(() => ScriptFileName);
  32.  
  33. if (this.ScriptFileName.Length > 0)
  34. {
  35. this.ScriptFileNameBorder = borderBrushNormal;
  36. this.scriptFileNameToolTip.Content = "Enter the name of the file.";
  37. }
  38. else
  39. {
  40. this.ScriptFileNameBorder = Brushes.Red;
  41. this.scriptFileNameToolTip.Content = "File name is required for saving.";
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement