BindValue to a Method
- We want that whenever the user changes the value for the
FromDate
column, the value of theToDate
column will automatically recompute to the "End of Month" of the date in theFromDate
column - Review the second overload of the
BindValue
method.
- Func
<Date>
means a method that returnDate
- see Func Power Point Presentation
public class DemoLocalColumns : UIControllerBase
{
public readonly DateColumn FromDate = new DateColumn("From Date");
public readonly DateColumn ToDate = new DateColumn("To Date");
public readonly NumberColumn DaysBetween = new NumberColumn("Days Between","5CN");
public DemoLocalColumns()
{
ToDate.BindValue(GetEndOfMonthOfFromDate);
}
public Date GetEndOfMonthOfFromDate()
{
return FromDate.EndOfMonth;
}
...
}
- Note that we are sending the method
GetEndOfMonthOfFromDate
as a parameter to theBindValue
method without parenthesis - Use
Debug.WriteLine
to demonstrate that theGetEndOfMonthOfFromDate
method calculates whenever we change theFromDate
column
For a deeper discussion of these topics see Lambda Expressions Generics and BindValue
Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com