Binding Custom View Properties
Introduction
Custom Properties in Controls
using Gum.Forms.Controls;
using Gum.Forms.DefaultVisuals.V3;
using Microsoft.Xna.Framework;
using MonoGameGum.GueDeriving;
using System;
namespace MonoGameAndGum;
public class ButtonWithSubtext : Button
{
TextRuntime _textRuntime;
public string Subtext
{
get => _textRuntime.Text;
set
{
if (_textRuntime.Text != value)
{
_textRuntime.Text = value;
}
}
}
public ButtonWithSubtext() : base()
{
ButtonVisual visual = (ButtonVisual)Visual;
_textRuntime = new TextRuntime();
this.AddChild(_textRuntime);
_textRuntime.Anchor(Gum.Wireframe.Anchor.Center);
_textRuntime.Y = 20;
_textRuntime.Color = Color.Yellow;
}
}
Last updated
Was this helpful?

