데이터 새로 고침을 위해 listview 및 ISingleOperation으로 양식을 만들었습니다.
그런 다음 ViewModel에서 명령을 만들었습니다.
public IRelayCommand LoadInvoicesCommand
{
get
{
return GetCommand(() => Execution.ViewModelExecute(new LoadInvoicesOperation(_model), 10000));
}
}
ISingleOperation이 잘 작동하고 반환합니다.
new Result() { ResultAction = ResultType.None };
새로 고침 작업이 잘 바인딩됩니다.
RefreshCommand="{Binding LoadInvoicesCommand}"
그러나 새로 고침 표시기가 "중단"되고 사라지지 않습니다. 여기서 무엇이 잘못 되었습니까?
ListView
명명 된 IsRefreshing 의 두 번째 속성을 ViewModel 에 바인딩 해야합니다. 이것은 부울 속성이며 ListView
새로 고침이 시작 / 완료되었음을 알리는 역할을합니다 .
ListView XAML의 예
<ListView
VerticalOptions="FillAndExpand"
IsPullToRefreshEnabled="true"
RefreshCommand="{Binding LoadInvoicesCommand}"
IsRefreshing="{Binding IsRefreshing, Mode=OneWay}"
ItemsSource="{Binding YourItemSource}"
ItemTemplate="{StaticResource ItemTemplate" />
ViewModel에는 호출 된 공용 속성 IsRefreshing
이 필요 false
하며 새로 고침 명령이 완료되면 이를로 설정해야합니다 .
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다