Xamarin.Forms 4.6-pre4 introduces the Expander
. It has a ForceUpdateSizeCommand
property, which invokes the ForceUpdateSize
public method.
However, binding the ForceUpdateSizeCommand
to an ICommand
is pointless as the Expander
class never calls ForceUpdateSizeCommand.Execute()
.
@AndreiMisiukevich Are you aware of this? Thanks!
@samhouts @davidbritch Hi.
This command's bindable property has OneWayToSource binding strategy.
It means that BindingContext should invoke this.
Please look at this
https://github.com/xamarin/Xamarin.Forms/blob/8a458aebef77d6a7b2614cfdb1b3aaadd3396015/Xamarin.Forms.Core/Expander.cs#L60
var expander = new Expander();
expander.SetBinding(Expander.ForceUpdateSizeCommandProperty, "UpdateSizeCommand");
expander.BindingContext = new ViewModel();
...
class ViewModel {
public ICommand UpdateSizeCommand { get; set; }
void DoSomething() {
....
UpdateSizeCommand?.Execute(null);
}
}
Hi @AndreiMisiukevich
Thanks for the explanation. I'm just struggling to envisage a useful scenario for a view model executing its own ICommand
. Any thoughts?
Hi @AndreiMisiukevich
Thanks for the explanation. I'm just struggling to envisage a useful scenario for a view model executing its own
ICommand
. Any thoughts?
e.g. you expand the expander control and at the bottom of your content you have a "show more" button that should expand it more.
@AndreiMisiukevich Got it, thanks!
Most helpful comment
@AndreiMisiukevich Got it, thanks!