public ItemControl() { InitializeComponent(); if (App.IsDesignMode) { var itemBrief = new ItemBrief { Id = "ChestArmor_204", Name = "Clever Bastion", Icon = "chestarmor_204_demo", DisplayColor = "yellow", TooltipParams = "item/CrgBCIOhjdABEgcIBBUtIhlgHQ1S3awdSJ3LyB2QJv6rHbfx7BodkwJj6iILCAAVrv4BABgMICIwCTjlBEAASARQDmDlBGolCgwIABDRxMStgICA4BsSFQj-uZaHChIHCAQVAZaumDAJOABAAWolCgwIABDkxMStgICA4BsSFQiw4YiZCxIHCAQVAZaumDAJOABAAWolCgwIABD1xMStgICA4BsSFQjT-sbSDRIHCAQVAZaumDAJOABAARjaiMmBDFAAWAI", RequiredLevel = 60, TypeName = "Rare Chest Armor", Type = new ItemType(), Gems = new Gem[] { new Gem { Item = new ItemBrief{ Icon = "emerald_08_demonhunter_male" } }, new Gem { Item = new ItemBrief{ Icon = "topaz_08_demonhunter_male" } }, new Gem { Item = new ItemBrief{ Icon = "amethyst_08_demonhunter_male" } }, } }; this.DataContext = new ItemViewModel(itemBrief, ItemSlot.Torso); } }
public ItemViewModel(ItemBrief item, ItemSlot itemSlot) { this.Item = item; this.ItemSlot = itemSlot; this.Gems = new ObservableCollection<GemViewModel>(); if (this.Item != null) { this.BackgroundUri = string.Format("/Resources/Images/{0}.png", this.Item.DisplayColor); this.BorderBrush = GetBorderBrush(this.Item.DisplayColor); this.ItemUri = App.GetItemImageUri(this.Item.Icon); this.SetOffset(this.ItemSlot); if (this.Item.Gems != null) { foreach (var gem in this.Item.Gems) { this.Gems.Add(new GemViewModel(gem)); } } } }