How to make a property change the UI in an IPlugin


  • Admin

    This feature will be available from 1.2.1 onwards.

    Import this namespace

    using RuriLib.ViewModels;
    

    Inherit your plugin class from ViewModelBase (along with implementing the IPlugin interface)

    public class ASimpleForm : ViewModelBase, IPlugin
    

    Change your properties (only the properties for which you want to be able to set the value and see a change on the UI)
    From this:

    [Text("First Name", "Your first name... duh")]
    public string FirstName { get; set; } = "John";
    

    To this:

    [Text("First Name", "Your first name... duh")]
    public string FirstName { get => firstName; set { firstName = value; OnPropertyChanged(); } }
    private string firstName = "John";
    

    Only the properties with the following attributes support the OnPropertyChanged() method:

    • Checkbox
    • Dropdown
    • InfoText
    • Numeric
    • Text
    • TextMulti

Log in to reply