❔ How to set relative properties ?
SelectedCallingCode.CallingCode: +31
PhoneNumber: 123456
FullPhoneNumber: +31 123456
Are these syntaxsyntaxes correct on the FullPhoneNumber ?
16 Replies
not really, no. You are declaring it a normal getter and setter, but its actually a "calculated" property that only uses other props to get its value
the setter doesnt use
value
, as you can see
You'll need to raise PropertyChanged events for FullPhoneNumber in the other setters
but have it declared simply as public string FullPhoneNumber => $"{SelectedCallingCode?.CallingCode} {PhoneNumber}";
Can you make this with a + in it ?
"+"
ofc
just add the +
okay
oh shoot I forgot
these are really from my boss
These props suppose to have inotifyprop change
Im assuming thats what
SetProperty
does
its a very common way to implement itDo you think SetProp related to that
yeah
I think too
but you need to raise two events here
because when PhoneNumber changes, FullPhoneNumber also changes
same for calling code
I know the MVVM toolkit source generators support this, but in this case you might need to manually implement it
the dude ban me from using
it
because he want these crap to able to work with blazor
¯\_(ツ)_/¯
Pobiega#2671
REPL Result: Success
Console Output
Compile: 515.197ms | Execution: 70.452ms | React with ❌ to remove this embed.
I tried this method but the prop require raise change for UI to work
Which is why I told you to raise events for that prop in the other props setters
since changing either of them will also change that value
Ah
I get it
Thanks mate
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.