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. WCF and WF
  4. How to trigger the Property Change from WCF service in Silverlight

How to trigger the Property Change from WCF service in Silverlight

Scheduled Pinned Locked Moved WCF and WF
csharpdatabasewcfasp-net
5 Posts 4 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.
  • V Offline
    V Offline
    Vimalsoft Pty Ltd
    wrote on last edited by
    #1

    Good Day All My Question goes as follows. I have a DataLayer in a Form of a WCF service and it is being consumed by a Business Layer that is also in a Form of a WCF Service and it is being consumed by a Silverlight Application. Now i have a Model in the DataLayer that defines the structure that comes from the Database, and this strucure model implements INotifyPropertyChanged interface to track the changes on the Properties. So basically , when the changes are made in silverlight , i want the Interface method to be fired in the Datalayer. now to go further with my requirement , i am doing the validation on the Properties like this

        public string CustomerSurname
        {
            get
            {
                return \_CustomerSurname;
            }
    
            set
            {
    
                if (!string.IsNullOrEmpty(value))
                {
                    \_CustomerSurname = value;
    
                    OnNotifyPropertyChanged("CustomerSurname");
                }
                else
                {
                    throw new Exception("Invalid Surname");
                }
            }
        }
    

    and obviously set binded control with the Proper binding property to show the Exception.

    Text="{Binding CustomerSurname, Mode=TwoWay,ValidatesOnExceptions=True}"

    The problem is the "changed" event does not get triggered, or rather my Exception does not show. Thanks

    Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa[at]dotnetfunda.com http://www.Dotnetfunda.com

    M N 2 Replies Last reply
    0
    • V Vimalsoft Pty Ltd

      Good Day All My Question goes as follows. I have a DataLayer in a Form of a WCF service and it is being consumed by a Business Layer that is also in a Form of a WCF Service and it is being consumed by a Silverlight Application. Now i have a Model in the DataLayer that defines the structure that comes from the Database, and this strucure model implements INotifyPropertyChanged interface to track the changes on the Properties. So basically , when the changes are made in silverlight , i want the Interface method to be fired in the Datalayer. now to go further with my requirement , i am doing the validation on the Properties like this

          public string CustomerSurname
          {
              get
              {
                  return \_CustomerSurname;
              }
      
              set
              {
      
                  if (!string.IsNullOrEmpty(value))
                  {
                      \_CustomerSurname = value;
      
                      OnNotifyPropertyChanged("CustomerSurname");
                  }
                  else
                  {
                      throw new Exception("Invalid Surname");
                  }
              }
          }
      

      and obviously set binded control with the Proper binding property to show the Exception.

      Text="{Binding CustomerSurname, Mode=TwoWay,ValidatesOnExceptions=True}"

      The problem is the "changed" event does not get triggered, or rather my Exception does not show. Thanks

      Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa[at]dotnetfunda.com http://www.Dotnetfunda.com

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Need NotifyOnValidationError?

      Text="{Binding CustomerSurname, Mode=TwoWay,ValidatesOnExceptions=True,NotifyOnValidationError=True}"

      Mark Salsbery :java:

      F 1 Reply Last reply
      0
      • M Mark Salsbery

        Need NotifyOnValidationError?

        Text="{Binding CustomerSurname, Mode=TwoWay,ValidatesOnExceptions=True,NotifyOnValidationError=True}"

        Mark Salsbery :java:

        F Offline
        F Offline
        fingerss5
        wrote on last edited by
        #3

        yES TRY ABOVE.I cant see the changed event for textbox

        M 1 Reply Last reply
        0
        • F fingerss5

          yES TRY ABOVE.I cant see the changed event for textbox

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Maybe the update source trigger...

          Text="{Binding CustomerSurname,Mode=TwoWay,UpdateSourceTrigger="PropertyChanged",ValidatesOnExceptions=True,NotifyOnValidationError=True}"

          Mark Salsbery :java:

          1 Reply Last reply
          0
          • V Vimalsoft Pty Ltd

            Good Day All My Question goes as follows. I have a DataLayer in a Form of a WCF service and it is being consumed by a Business Layer that is also in a Form of a WCF Service and it is being consumed by a Silverlight Application. Now i have a Model in the DataLayer that defines the structure that comes from the Database, and this strucure model implements INotifyPropertyChanged interface to track the changes on the Properties. So basically , when the changes are made in silverlight , i want the Interface method to be fired in the Datalayer. now to go further with my requirement , i am doing the validation on the Properties like this

                public string CustomerSurname
                {
                    get
                    {
                        return \_CustomerSurname;
                    }
            
                    set
                    {
            
                        if (!string.IsNullOrEmpty(value))
                        {
                            \_CustomerSurname = value;
            
                            OnNotifyPropertyChanged("CustomerSurname");
                        }
                        else
                        {
                            throw new Exception("Invalid Surname");
                        }
                    }
                }
            

            and obviously set binded control with the Proper binding property to show the Exception.

            Text="{Binding CustomerSurname, Mode=TwoWay,ValidatesOnExceptions=True}"

            The problem is the "changed" event does not get triggered, or rather my Exception does not show. Thanks

            Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa[at]dotnetfunda.com http://www.Dotnetfunda.com

            N Offline
            N Offline
            NeillJam
            wrote on last edited by
            #5

            Hi, Don't know if you have solved this yet, but maybe this will help. I am assuming (oops) that your class is inheriting from INotifyPropertyChanged. Also I don't see in your code (you probably just aren't showing it) the event declaration ie public event PropertyChangedEventHandler PropertyChanged; as well as the OnNotifyPropertyChanged method, although if it wasn't there the OnNotifyPropertyChanged("CustomerSurname"); would complain loudly. The other thing I don't see , and this is what got me in the beginning, is setting the data context. Without it the binding doesn't work. so lets say you have this public class TestingBinding : INotifyPropertyChanged { All your code here } Then using your class: TestingBinding newBindTest = new TestingBinding(); this.DataContext = newBindTest; //<------ without this binding won't work. Hope that helps you out. Regards, Neill

            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