-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCustomControl.cs
33 lines (27 loc) · 926 Bytes
/
CustomControl.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using Godot;
using Godot.Community.ControlBinding;
using Godot.Community.ControlBinding.Extensions;
using Godot.Community.ControlBinding.Formatters;
using Godot.Community.ControlBinding.Interfaces;
using PropertyChanged.SourceGenerator;
using System;
namespace ControlBinding;
public partial class CustomControl : Control, IObservableObject
{
[Notify]
private string _input;
private BindingContext _bindingContext;
public override void _Ready()
{
_bindingContext = new BindingContext(this);
GetNode<LineEdit>("%LineEdit").BindProperty(_bindingContext, nameof(LineEdit.Text), nameof(Input), BindingMode.OneWayToTarget,
new ValueFormatter
{
FormatTarget = (v, _) => $"Input: {v}",
});
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}