Current filter:
                                You should refresh the page.
                                  • Hi

                                    Is there an option to change the template for the function "Convert to Property with Change Notification"

                                    The default setting:

                                          int myProperty;
                                            public int MyProperty
                                            {
                                                get
                                                {
                                                    return myProperty;
                                                }
                                                set
                                                {
                                                    if (myProperty == value)
                                                        return;
                                                    myProperty = value;
                                                    RaisePropertyChanged(nameof(MyProperty));
                                                }
                                            }

                                    But I use it every time with "OnPropertyChange();" but not with "RaisePropertyChanged(nameof(MyProperty));"

                                    How can I change it?

                                    Thanks
                                    Michael 

                                • Alexander K (DevExpress) 06.06.2017

                                  Hi Michael,

                                  Thank you for providing the code sample. The 'Convert to Property with Change Notification' code action automatically finds a method in your class (or base classes) that raises the PropetyChanged event and generates a call of this method. In your case, it found the RaisePropertyChanged method. If I get you right, then your class contains two methods that raise the PropertyChanged event. Please provide us with code of these methods (OnPropertyChange and RaisePropertyChanged) or with the whole code of a problematic class. It will help us better understand your case and improve the logic of our features which generate the change notification template.

                                • Michael Draxler 06.07.2017

                                  Hi Alexander

                                  In my base class there some OnPropertyChange methodes:
                                  for simple call PropertChanged Event (don't had to write the name of the propertiy)

                                          public void OnPropertyChanged([CallerMemberName]string propertyName = null)
                                          {
                                              OnPropertyChanged(propertyName, true); -> call main OnPropertyChange methode
                                          }

                                  For select, if the PropertyChange Event will call with Parameter "makeDirty"
                                  makeDirty tells if a class (i.e. addresses) had changes, and I had to Display to save it

                                          public void OnPropertyChanged(bool makeDirty, [CallerMemberName]string propertyName = null)
                                          {
                                              OnPropertyChanged(propertyName, makeDirty);
                                          }

                                  the main methode for setting all other important properties on OnPropertyChange

                                          public void OnPropertyChanged(string propertyName, bool makeDirty)
                                          {
                                              RaisePropertiesChanged(propertyName);
                                              if (_IsSuppressDirty)
                                                  return;
                                              if (makeDirty)
                                              {
                                                  IsDirty = true;
                                                  if (IsDirtyChanged != null)
                                                  {
                                                      var e = new EventArgsPropertyInListChanged()
                                                      {
                                                          PropertyName = propertyName,
                                                          ChangedItem = this
                                                      };
                                                      IsDirtyChanged(this, e);
                                                  }
                                              }
                                              //Validate();
                                          }

                                  As I wrote the CodeRush set the Notification to RaisePropertyChanged of the DevExpress.Mvvm Namespace

                                  I hope it is now clearer.

                                  I want to say CodeRush, do not use the "RaisePropertyChanged" from DevExpress.Mvvm Namespace, use my "OnPropertyChanged()" Methode

                                  Thanks
                                  Michael

                                • Alexander K (DevExpress) 06.08.2017

                                  Thank you for providing the code samples. We currently understand your case. Please give us some time to discuss the best way to support this functionality in our product. We will notify you.

                                • Alexander K (DevExpress) 06.09.2017

                                  Thank you for your patience. We have decided to improve logic CodeRush features that generate property change notification. So, they will automatically detect that the OnPropertyChanged method should be used in your case. We will notify you of our progress.

                                1 Solution

                                Creation Date Importance Sort by

                                Fixed:

                                • Michael Draxler 07.27.2017

                                  Hello Alexander

                                  I downloaded and installed the new CodeRush for Roslyn Version 17.1.6

                                  But it is the same as before

                                  I press "ps" for Property string
                                  ->

                                          string propertyName;
                                          public string PropertyName
                                          {
                                              get { return propertyName; }
                                              set
                                              {
                                                  if (propertyName == value)
                                                      return;
                                                  propertyName = value;
                                                  RaisePropertyChanged(nameof(PropertyName));
                                              }
                                          }

                                  The same as before!?
                                  Do I have to change any configuration?

                                  br
                                  Michael

                                • Alexander K (DevExpress) 07.28.2017

                                  Hi Michael,

                                  This functionality should work by default and doesn't require additional configuration. It seems we incorrectly used the 'RaisePropertyChanged' method instead of 'RaisePropertiesChanged' in our sample. Therefore, our fix doesn't work on your side. Please accept our apologies for this. We will correct it and provide a hotfix build that completely supports your case.

                                  If it is acceptable for you, I suggest you change your implementation and use the 'RaisePropertyChanged' method as a temporary workaround.

                                • Alexander K (DevExpress) 08.03.2017

                                  Hi Michael,

                                  We have made necessary changes to completely support your case and prepared a special build:

                                  DevExpress.CodeRush.Roslyn-17.1.6.17215.vsix
                                  DevExpress.CodeRush.Roslyn-17.1.6.17215.exe

                                  Please install this build and let us know whether template expansions work as you require.

                                • Michael Draxler 08.21.2017

                                  I installed Version 17.1.7.
                                  Thank works fine for me !!!

                                  br
                                  Michael

                                • Alexander K (DevExpress) 08.22.2017

                                  You are welcome, Michael. We are happy to hear that this build solved the issue.