Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Validation in silverlight datagrid?

Validation in silverlight datagrid?

Scheduled Pinned Locked Moved WPF
questioncsharpwcfcombusiness
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mittalpa
    wrote on last edited by
    #1

    Hi I know that we can add the Validator.ValidateProperty call inside the buisness object and decorate it as [Required] like as follows. Reference : http://blogs.msdn.com/b/nagasatish/archive/2009/03/22/datagrid-validation.aspx

        \[Required\]
        public string FirstName
        {
            get { return firstName; }
            set
            {
                if (value != firstName)
                {
                    Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "FirstName" });
                    firstName = value;
                    NotifyPropertyChanged("FirstName");
                }
            }
        }
    

    My problem with this approach is that auto generated classes do not contain any validation logic inside them. I am generating the classes from an xsd (XSD2Code utility) and have to use these DTOs because all layers are utilizing them. Silverlight->WCF->Business layer->Data Access layer : All using common DTO classes My questions are : 1. How can I incorporate validations for datagrid entry fields without adding them into plain classes? 2. Is there a way that I can add all these rules in xsd and have them written out inside classes? Please advise. Thanks AJ

    Follow your goals, Means will follow you ---Gandhi---

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups