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

WPF

 
GeneralRe: DP not Working Pin
Kevin Marois28-Jul-16 14:14
professionalKevin Marois28-Jul-16 14:14 
SuggestionRe: DP not Working Pin
Richard Deeming29-Jul-16 2:11
mveRichard Deeming29-Jul-16 2:11 
GeneralRe: DP not Working Pin
Richard Deeming29-Jul-16 2:12
mveRichard Deeming29-Jul-16 2:12 
GeneralRe: DP not Working Pin
PureNsanity29-Jul-16 3:47
professionalPureNsanity29-Jul-16 3:47 
AnswerRe: DP not Working Pin
Meshack Musundi2-Aug-16 22:33
professionalMeshack Musundi2-Aug-16 22:33 
QuestionScrolling data table area on a XAML page Pin
Stephen Holdorf26-Jul-16 13:41
Stephen Holdorf26-Jul-16 13:41 
AnswerRe: Scrolling data table area on a XAML page Pin
Mycroft Holmes26-Jul-16 14:32
professionalMycroft Holmes26-Jul-16 14:32 
GeneralRe: Scrolling data table area on a XAML page Pin
Stephen Holdorf27-Jul-16 0:31
Stephen Holdorf27-Jul-16 0:31 
GeneralRe: Scrolling data table area on a XAML page Pin
Mycroft Holmes27-Jul-16 12:44
professionalMycroft Holmes27-Jul-16 12:44 
QuestionWhere to call OnPropertyChanged Pin
Bernhard Hiller25-Jul-16 21:47
Bernhard Hiller25-Jul-16 21:47 
AnswerRe: Where to call OnPropertyChanged Pin
Gerry Schmitz26-Jul-16 3:47
mveGerry Schmitz26-Jul-16 3:47 
QuestionEnter key invokes button click Pin
GrooverFromHolland23-Jul-16 9:44
GrooverFromHolland23-Jul-16 9:44 
AnswerRe: Enter key invokes button click Pin
Mycroft Holmes23-Jul-16 14:28
professionalMycroft Holmes23-Jul-16 14:28 
GeneralRe: Enter key invokes button click Pin
GrooverFromHolland24-Jul-16 0:19
GrooverFromHolland24-Jul-16 0:19 
GeneralRe: Enter key invokes button click Pin
Mycroft Holmes24-Jul-16 14:34
professionalMycroft Holmes24-Jul-16 14:34 
QuestionUsing negative height margin values to properly vertically align a control Pin
Stephen Holdorf22-Jul-16 14:22
Stephen Holdorf22-Jul-16 14:22 
AnswerRe: Using negative height margin values to properly vertically align a control Pin
Stephen Holdorf23-Jul-16 4:50
Stephen Holdorf23-Jul-16 4:50 
GeneralRe: Using negative height margin values to properly vertically align a control Pin
Stephen Holdorf23-Jul-16 9:47
Stephen Holdorf23-Jul-16 9:47 
QuestionList Control Question Pin
Kevin Marois21-Jul-16 14:36
professionalKevin Marois21-Jul-16 14:36 
AnswerRe: List Control Question Pin
Gerry Schmitz22-Jul-16 11:18
mveGerry Schmitz22-Jul-16 11:18 
QuestionKeeping correct layout when browser is resized Pin
Stephen Holdorf17-Jul-16 3:37
Stephen Holdorf17-Jul-16 3:37 
AnswerRe: Keeping correct layout when browser is resized Pin
Gerry Schmitz18-Jul-16 6:19
mveGerry Schmitz18-Jul-16 6:19 
QuestionStyling a Drag and Drop Items behavior in a WPF ListView Pin
Kenneth Haugland13-Jul-16 5:43
mvaKenneth Haugland13-Jul-16 5:43 
QuestionShort way defining a property with the NotifyPropertyChanged() call Pin
Mc_Topaz9-Jul-16 9:26
Mc_Topaz9-Jul-16 9:26 
Here is a common way of having a ViewModel's property with the INotifyPropertyChanged interface:
C#
string text;
public string Text
{
    get { return text; }
    set
    {
        if (value != text)
        {
            text = value;
            NotifyPropertyChanged(nameof(Text));
        }
    }
}

This occupies one line for the member variable and twelve lines for the property.
In my ViewModel I have many properties and the code is getting very huge due to each property need the above body to include the NotifyPropertyChanged method and a member varible.

I prefer my properties to be defined in this way:
C#
public string Text { get; set; }

That property's body is just one line and I don't need to define a member variable.
But I cannot find out how to call the NotifyPropertyChanged method.

Is there a solution to short the body of the property and still have the call to the NotifyPropertyChanged method?

For instance:
* Having a property without the need of a member variable.
* Define the property as close as possible to: public string Text { get; set; }.
* Having the call to the NotifyPropertyChanged in the setter body.


Best regards,
/Steffe
AnswerRe: Short way defining a property with the NotifyPropertyChanged() call Pin
Mycroft Holmes9-Jul-16 11:35
professionalMycroft Holmes9-Jul-16 11:35 

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.