コード例 #1
0
        private void PopulatePWT91DataTable()
        {
            DataSet ds = new DataSet();

            ds.ReadXml(new StringReader(Properties.Resources.pwt91));
            dt = ds.Tables[0];

            CountriesViewModel.CountryItems.Clear();
            string[] columns = { "countrycode", "country", "currency_unit" };
            foreach (DataRow dr in dt.DefaultView.ToTable(true, columns).Rows)
            {
                CountriesViewModel.CountryItems.Add(CountryVM.NewCountryVM(PWTCountry.NewCountry(dt.Select($"countrycode = '{dr["countrycode"]}'"))));
            }
        }
コード例 #2
0
        public static CountriesListVM CreateObject()
        {
            CountriesListVM clvm = new CountriesListVM
            {
                CountryItems = new ObservableCollection <CountryVM>()
            };

            clvm.View        = CollectionViewSource.GetDefaultView(clvm.CountryItems);
            clvm.View.Filter = o =>
            {
                CountryVM c = o as CountryVM;
                return(c.CountryDataIsSufficient);
            };
            return(clvm);
        }