J'ai encore besoin d'aides.
pour info c'est du code Windows phone, exemple de l'appli pivot
Dans le .cs j'ai mis cela :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| public MainPage()
{
InitializeComponent();
// Affecter l'exemple de données au contexte de données du contrôle ListBox
DataContext = App.ViewModel;
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
//ici vue:
object src1 = this.Resources["srf"];
ICollectionView collectionView = CollectionViewSource.GetDefaultView(srf); //GetDefaultView non reconnu !?
collectionView.Filter = new Predicate<object>(FilterSurface);
}
public bool FilterSurface(object item)
{
ItemViewModel cat0 = item as ItemViewModel;
if ((cat0 == null) || cat0.Category==0)
{
return false;
}
else
{
return true;
}
} |
côté XAML :
1 2 3
| <phone:PhoneApplicationPage.Resources>
<local:ItemViewModel x:Key="srf"/>
</phone:PhoneApplicationPage.Resources> |
et sur la listbox j'ai ajouté ça:
<ListBox x:Name="FirstListBox" Margin="0,0,-12,0" ItemsSource="{Binding Items, Source={StaticResource srf}}" ...
Mais GetDefaultView n'est pas reconnu ? il y a un using particulier ?
Partager