2016-08-03 2 views
0

그래서 저는 Xamarin을 처음 사용하고 저에게 저장 한 약속에 대해 생각 나게하는 App을 작성하고 싶습니다. 이를 위해 앞으로 예정된 약속 목록을 만들었습니다. 그러나 과거에 거짓말을 한 목록에서 자동으로 약속을 제거하는 방법을 모르겠습니다. 관련 XAML 파일은 다음과 같습니다listView에서 불필요한 데이터를 제거하는 방법은 무엇입니까?

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:constants="clr-namespace:XamarinFormsSample;assembly=XamarinFormsXamlSample" 
x:Class="My.View.AppointmentCalendarView" 
Title="AppointmentCalendarPage"> 
    <ListView x:Name="AppointmentView"> 
    <ListView.ItemTemplate> 
     <DataTemplate> 
     <TextCell Text="{Binding AppointmentDate}: {Binding AppointmentType}" /> 
     </DataTemplate> 
    </ListView.ItemTemplate> 
    </ListView> 
</ContentPage> 

를 마지막 부분에서

{ 
    public class AppointmentCalendarPage : ContentPage 
    { 
     ListView AppointmentView = new ListView(); 
     ObservableCollection<Appointment> appointments = new ObservableCollection<Appointment>(); 
     public AppointmentCalendarPage() 
     { 
      AppointmentView.ItemsSource = appointments; 
      Appointments.Add(new Appointment { ID = 0, Host = 0, AppointmentDate = new DateTime(2016, 12, 24), AppointmentType = "Christmas" }); 
     } 

    } 
} 

에 의해 정의 된 목록으로, 예약 클래스의 관련 데이터는 명확해야한다.

MV 또는 M면에서 약속 통과 사례를 처리하려면 어떻게해야합니까?

+0

관찰 가능한 컬렉션에서 제거 할 수 있습니다. –

+0

어떻게하면됩니까? – JLN

+0

https://msdn.microsoft.com/en-us/library/ms654938(v=vs.110).aspx –

답변

0

Rohit이 제안했듯이 관찰 가능 컬렉션에서 항목을 제거 할 수 있습니다. 언제해야 할 것인가하는 것이 또 다른 문제입니다. Xamarin Forms의 App lifecycle of the app을 살펴 보시기 바랍니다.

앱 재개시 올바른 작업을 수행 할 수 있습니다.

관련 문제