What does the completion handler look like in C # when trying to animate?

I want to translate this code

[UIView animateWithDuration:0.25 animations:^{ self.datePicker.alpha = 0.0f; } completion:^(BOOL finished){ self.datePicker.hidden = YES; } ]; 

for Xamarin iOS:

 UIView.Animate (0.25, animation: () => { this.datePicker.Alpha = 0.0f; }, completion: (finished){ this.datePicker.Hidden = true; } ); 

The problem is the completion block. How to use bool finished here?

I get

Unexpected symbol {

+6
source share
2 answers

This is the main expression of lambda .

 UIView.Animate (0.25, animation: () => { this.datePicker.Alpha = 0.0f; }, completion: () => { this.datePicker.Hidden = true; } ); 

Or, since you have only one statement in your body, you can shorten it even further to

 UIView.Animate (0.25, animation: () => this.datePicker.Alpha = 0.0f, completion: () => this.datePicker.Hidden = true ); 
+8
source

Use UIView.AnimateNotify () to get a delegate for the completion handler that uses the bool parameter.

+2
source

Source: https://habr.com/ru/post/975477/