namespace MyGameProject;
public class ItemSlot : ButtonBase<Panel>
{
// ...
}
Project.ExtraWidgetAssembliesAndNamespaces.Add( typeof( ItemSlot ).Assembly, new string[] { typeof( ItemSlot ).Namespace } );
Grid g = Project.LoadFromXml(File.ReadAllText(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "assets/inventory.xmmp")), MyraUtil.AssetManager).Root as Grid;
var slots = g.GetChildren().Where(w => w is ItemSlot).Cast<ItemSlot>().ToArray();
slots[0].Stack = new Items.ItemStack("dagger") { Quantity = 1 };
<?xml version="1.0" encoding="UTF-8" ?>
<Project>
<Project.ExportOptions />
<Grid RowSpacing="4" ColumnSpacing="4">
<Grid.DefaultColumnProportion Type="Pixels" Value="40"/>
<Grid.DefaultRowProportion Type="Pixels" Value="40"/>
<ItemSlot GridRow="0" GridColumn="0" />
<!-- a lot more of ItemSlot with different GridRow / GridColumn here -->
</Grid>
</Project>
Example: