Click here to Skip to main content
15,915,600 members
Home / Discussions / WPF
   

WPF

 
QuestionHow to you generate itemized lists in a RichTextBox? [NO SOLUTION POSSIBLE] Pin
fjparisIII22-May-10 4:12
fjparisIII22-May-10 4:12 
AnswerRe: How to you generate itemized lists in a RichTextBox? Pin
Kunal Chowdhury «IN»24-May-10 8:37
professionalKunal Chowdhury «IN»24-May-10 8:37 
GeneralRe: How to you generate itemized lists in a RichTextBox? Pin
fjparisIII24-May-10 9:17
fjparisIII24-May-10 9:17 
QuestionHow do you adjust leading between paragraphs in RichTextBox? [SOLVED THROUGH A KLUDGE] Pin
fjparisIII22-May-10 4:10
fjparisIII22-May-10 4:10 
AnswerRe: How do you adjust leading between paragraphs in RichTextBox? [SOLVED THROUGH A KLUDGE] Pin
Abhinav S24-May-10 17:28
Abhinav S24-May-10 17:28 
QuestionValidation Messages [modified] Pin
Tripathi Swati21-May-10 23:02
Tripathi Swati21-May-10 23:02 
AnswerRe: Validation Messages Pin
Abhinav S22-May-10 0:30
Abhinav S22-May-10 0:30 
GeneralRe: Validation Messages Pin
Tripathi Swati24-May-10 19:27
Tripathi Swati24-May-10 19:27 
below is used for binding validation

<TextBox x:Name="txtDispalyName" Text="{Binding Path=DisplayName, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}" Grid.Row="1"  Height="24" LostFocus="txtDispalyName_LostFocus"   Grid.Column="2"  Margin="18,2,54,0" VerticalAlignment="Top" TabIndex="0" >



while in code behind on save click i m calling below code
ViewModel.IsError = true; 
getBindProperty();
if (ViewModel.Save())
{
                IsSaveClose = true;
                SaveData();

}
else
{
ViewModel._dialogService.DisplayValidationDialog(ViewModel.Errors);
}




while my validation class is

public class MyViewModel : INotifyPropertyChanged
    {
        public readonly IDialogService _dialogService;
        CultureInfo Culture;
        public MyViewModel(IDialogService dialogService)
        {
            _dialogService = dialogService;
        }

      
        private string _displayName = "";
         

        public bool  IsError { get; set; }
        
        

        public string DisplayName
        {
            get { return _displayName ; }
            set
            {
                if (string.IsNullOrEmpty(value))
                {
                    Culture = Thread.CurrentThread.CurrentCulture;
                    IsError = false;
                    throw new Exception(Erp3s.Resources.Strings.ResourceManager.GetString("Display Name is required",Culture));

                }
                _displayName = value;
                OnPropertyChanged("DisplayName");
            }
        }

      


        private readonly ObservableCollection<ValidationError> _errors = new ObservableCollection<ValidationError>();

        public ObservableCollection<ValidationError> Errors
        {
            get { return _errors; }
        }

        public bool IsViewStateValid()
        {
            return Errors.Count == 0;
        }

        public bool Save()
        {

                     
            
            
         if (!this.IsViewStateValid())
            {
                return false; 
              //_dialogService.DisplayValidationDialog(Errors);
            }
            else
            {
                return true;
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler pceh = PropertyChanged;
            if (pceh != null)
            {
                pceh(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }


for reference i had referred http://www.thejoyofcode.com/Silverlight_Validation_and_MVVM_Part_II.aspx[^]

but my problem is when i click on save button and if i will clear my textbox then also this validations are fired.
Reasons are not Important but Results are Important.
http://www.sql4professional.blogspot.com
Swati Tripathi

AnswerRe: Border as control Pin
Jürgen Röhr22-May-10 2:23
professionalJürgen Röhr22-May-10 2:23 
GeneralRe: Border as control Pin
Jürgen Röhr22-May-10 21:40
professionalJürgen Röhr22-May-10 21:40 
AnswerRe: Border as control Pin
Abhinav S22-May-10 2:30
Abhinav S22-May-10 2:30 
QuestionHow do you color a rectangle in C# that has been declared in XAML in WPF? Pin
Xarzu21-May-10 16:11
Xarzu21-May-10 16:11 
AnswerRe: How do you color a rectangle in C# that has been declared in XAML in WPF? Pin
Pete O'Hanlon21-May-10 23:44
mvePete O'Hanlon21-May-10 23:44 
GeneralRe: How do you color a rectangle in C# that has been declared in XAML in WPF? Pin
Xarzu22-May-10 1:58
Xarzu22-May-10 1:58 
GeneralRe: How do you color a rectangle in C# that has been declared in XAML in WPF? Pin
Pete O'Hanlon22-May-10 2:28
mvePete O'Hanlon22-May-10 2:28 
GeneralRe: How do you color a rectangle in C# that has been declared in XAML in WPF? Pin
Xarzu24-May-10 5:09
Xarzu24-May-10 5:09 
QuestionHow do you send a refresh message to a WPF grid or canvas? Pin
Xarzu21-May-10 16:10
Xarzu21-May-10 16:10 
AnswerRe: How do you send a refresh message to a WPF grid or canvas? Pin
Jürgen Röhr22-May-10 3:11
professionalJürgen Röhr22-May-10 3:11 
QuestionWPF TreeView - Get Reference To Image On Node Pin
Kevin Marois21-May-10 7:56
professionalKevin Marois21-May-10 7:56 
AnswerRe: WPF TreeView - Get Reference To Image On Node Pin
Pete O'Hanlon21-May-10 9:20
mvePete O'Hanlon21-May-10 9:20 
GeneralRe: WPF TreeView - Get Reference To Image On Node Pin
Kevin Marois21-May-10 10:20
professionalKevin Marois21-May-10 10:20 
QuestionTwo Way Data Binding In Wpf Pin
Manohar.K21-May-10 0:15
Manohar.K21-May-10 0:15 
AnswerRe: Two Way Data Binding In Wpf Pin
Pete O'Hanlon21-May-10 0:55
mvePete O'Hanlon21-May-10 0:55 
GeneralRe: Two Way Data Binding In Wpf Pin
Manohar.K21-May-10 1:35
Manohar.K21-May-10 1:35 
GeneralRe: Two Way Data Binding In Wpf Pin
Pete O'Hanlon21-May-10 1:54
mvePete O'Hanlon21-May-10 1:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.