문제

나는 응용 프로그램를 위한 윈도우 스토어(된 이 패턴)사용하여 C#/XAML.현재 뷰를 표시하는 카테고리의 코스가 목록으로 수행 한다.

<CollectionViewSource x:Name="groupedItemsViewSource"
                      Source="{Binding Path=ListCourses}"
                      IsSourceGrouped="true"
                      ItemsPath="Courses" />

코스 목록에트:

<GridView
   x:Name="itemGridView"
   AutomationProperties.AutomationId="ItemGridView"
   AutomationProperties.Name="Grouped Items"
   Grid.RowSpan="2"
   Padding="116,35,40,46"
   SelectionMode="Single"
   ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}"
   ItemTemplate="{StaticResource ListCourseItemTemplate}"
   SelectedItem="{Binding SelectedItem, Mode=TwoWay}"         
   IsSwipeEnabled="false"
   IsItemClickEnabled="True">      
     <GridView.ItemsPanel>
          <ItemsPanelTemplate>
                <VirtualizingStackPanel Orientation="Horizontal"/>
           </ItemsPanelTemplate>
     </GridView.ItemsPanel>
     <GridView.GroupStyle>
         <GroupStyle>
             <GroupStyle.HeaderTemplate>
                 <DataTemplate>
                     <Grid Margin="1,0,0,6">
                         <Button AutomationProperties.Name="Group Title"
                                 Foreground="{StaticResource WShopperAccentTextBrush}"
                                 Style="{StaticResource TextPrimaryButtonStyle}">
                                 <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding Name}" Margin="3,-7,10,10" Style="{StaticResource GroupHeaderTextStyle}" />
                                    <TextBlock Text="{StaticResource ChevronGlyph}" FontFamily="Segoe UI Symbol" Margin="0,-7,0,10" Style="{StaticResource GroupHeaderTextStyle}"/>
                                 </StackPanel>
                          </Button>
                      </Grid>
                 </DataTemplate>
             </GroupStyle.HeaderTemplate>
             <GroupStyle.Panel>
                  <ItemsPanelTemplate>
                      <VariableSizedWrapGrid Orientation="Vertical" Margin="0,0,80,0"/>
                  </ItemsPanelTemplate>
              </GroupStyle.Panel>
         </GroupStyle>
     </GridView.GroupStyle>
</GridView>

카테고리:

public Category()
{

}
public int Id { get; set; }

public string Name { get; set; }


public IEnumerable<Course> Courses { get; set; }

제가 보기에는 모델 ListCourses 는 시설은 다음과 같다:

public ObservableCollection<Category> ListCourses
{
    get { return _listCourses; }
    private set { SetProperty(ref _listCourses, value); }
}

나의 질문은:때를 제거 과정에서 그것은 목록(제거하는 항목에서트)서버 업데이트하지 않고 현재 데이터 ListCourses property??

제 func:

     var category = ListCourses.FirstOrDefault(cat => cat.Id == SelectedItem.CategoryId);
        category.Courses.Remove(SelectedItem);
        OnPropertyChanged("ListCourses");

어떤 아이디어??

도움이 되었습니까?

해결책

category.Courses 해야하는 ObservableCollection 너무입니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top