Quantcast
Channel: Managed Extensibility Framework
Viewing all articles
Browse latest Browse all 265

New Post: How to build Hierarchical ViewModel using MEF

$
0
0
at least could anybody implement the following two classes using MEF and I will follow up for rest of the sample
public class CountryViewModel
{
readonly ReadOnlyCollection<RegionViewModel> _regions;
public ReadOnlyCollection<RegionViewModel> Regions
{
get { return _regions; }
}
//---------------------------------------------------------
public CountryViewModel(Region[] regions)
{
_regions = new ReadOnlyCollection<RegionViewModel>(
(from region in regions
select new RegionViewModel(region))
.ToList());
}
}


public class RegionViewModel : TreeViewItemViewModel
{
readonly Region _region;
public RegionViewModel(Region region)
: base(null, true)
{
_region = region;
}
public string RegionName
{
get { return _region.RegionName; }
}
protected override void LoadChildren()
{
foreach (State state in Database.GetStates(_region))
base.Children.Add(new StateViewModel(state, this));
}
}

Viewing all articles
Browse latest Browse all 265

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>