Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <TextBox ToolTip="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}">
- <TextBox.Text>
- <Binding Path="ScriptFileMap" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
- <Binding.ValidationRules>
- <v:MinimumStringLengthRule MinimumLength="1" ErrorMessage="Map is required for saving." />
- </Binding.ValidationRules>
- </Binding>
- </TextBox.Text>
- </TextBox>
- public void SaveScript()
- {
- if (this.ScriptFileName.Length > 0 && this.ScriptFileMap.Length > 0)
- {
- // save function logic
- }
- }
- <TextBox Text="{Binding Path=ScriptFileName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" BorderBrush="{Binding Path=ScriptFileNameBorder, UpdateSourceTrigger=PropertyChanged}" ToolTip="{Binding Path=ScriptFileNameToolTip, UpdateSourceTrigger=PropertyChanged}" />
- public string ScriptFileName
- {
- get
- {
- return this.scriptFileName;
- }
- set
- {
- this.scriptFileName = value;
- RaisePropertyChanged(() => ScriptFileName);
- if (this.ScriptFileName.Length > 0)
- {
- this.ScriptFileNameBorder = borderBrushNormal;
- this.scriptFileNameToolTip.Content = "Enter the name of the file.";
- }
- else
- {
- this.ScriptFileNameBorder = Brushes.Red;
- this.scriptFileNameToolTip.Content = "File name is required for saving.";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement