Skip to content
Skills Library
Programming · Building & coding

binding-mewui-data

/binding-mewui-data

Binds MewUI controls to data using ObservableValue and ValueBinding. Use when implementing reactive UI updates, building ViewModels, or connecting controls to data sources.

Licence
MIT
Last repository change
21.07.2026

Assessment and security

95/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content30 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 21.07.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Binds MewUI controls to data using ObservableValue and ValueBinding. Use when implementing reactive UI updates, building ViewModels, or connecting controls to data sources.

Original author description

Binds MewUI controls to data using ObservableValue and ValueBinding. Use when implementing reactive UI updates, building ViewModels, or connecting controls to data sources.

How it works

  1. ObservableValue<T>
  2. Fluent Binding
  3. ViewModel Pattern
  4. ValueBinding<T> (Low-level)
  5. Preventing Binding Loops
Original SKILL.md headings · 119 lines, 301 words
SKILL.md preview
---
name: binding-mewui-data
description: "Binds MewUI controls to data using ObservableValue and ValueBinding. Use when implementing reactive UI updates, building ViewModels, or connecting controls to data sources."
---

## ObservableValue<T>

Reactive value container:

```csharp
// Create
var name = new ObservableValue<string>("Initial");
var count = new ObservableValue<int>(0);
var enabled = new ObservableValue<bool>(true);

// Read/Write
string current = name.Value;
name.Value = "New";  // Triggers Changed event

// Subscribe via Changed event
name.Changed += () => Console.WriteLine($"Changed to: {name.Value}");

// With coercion (value constraint)
var percent = new ObservableValue<double>(50, coerce: v => Math.Clamp(v, 0, 100));
percent.Value = 150;  // Becomes 100
```

---

## Fluent Binding

```csharp
var vm = new MyViewModel();

new StackPanel().Children(
    // One-way (source → UI)
    new Label().BindText(vm.Message),

    // Two-way (source ↔ UI)
    new TextBox().BindText(vm.Name),
    new CheckBox().BindIsChecked(vm.IsEnabled),
    new Slider().BindValue(vm.Volume),

    // With converter
    new Label().BindText(vm.Count, c => $"Count: {c}"),

    // Common bindings
    new Button().BindIsEnabled(vm.CanSubmit).BindIsVisible(vm.ShowButton)
)
```

---

## ViewModel Pattern

```csharp
public class PersonViewModel
{
    public ObservableValue<string> FirstName { get; } = new("");
    public ObservableValue<string> LastName { get; } = new("");
    public ObservableValue<string> FullName { get; } = new("");
    public ObservableValue<bool> IsValid { get; } = new(false);

    public PersonViewModel()
    {
        FirstName.Changed += Update;
        LastName.Changed += Update;
    }

    private void Update()
    {
        FullName.Value = $"{FirstName.Value} {LastName.Value}".Trim();
        IsValid.Value = FirstName.Value.Length > 0 && LastName.Value.Length > 0;
    }
}
```

---

## ValueBinding<T> (Low-level)

```csharp
// Note: subscribe/unsubscribe use lambda pattern, not method group
var binding = new ValueBinding<string>(
    get: () => source.Value,
    set: v => source.Value = v,  // null for one-way
    subscribe: h => source.Changed += h,
    unsubscribe: h => source.Changed -= h,
    onSourceChanged: () => control.Text = source.Value
);
```

---

## Preventing Binding Loops

```csharp
private bool _suppressBindingSet;

public string Text
{
    get => _text;
    set {
        if (_text != value) {
            _text = value;
            if (!_suppressBindingSet) _binding?.Set(value);
            InvalidateMeasure();
        }
    }
}

private void SetTextFromSource(string value)
{
    _suppressBindingSet = true;
    try { Text = value; }
    finally { _suppressBindingSet = false; }
}
```

---

**Advanced patterns**: See [viewmodel-patterns.md](viewmodel-patterns.md)
Files in this package (2)
  • SKILL.md 3 KB
  • viewmodel-patterns.md 5 KB

Versions

The database has no other skills named binding-mewui-data.

Database snapshot: 13.11.2026 · package version afc492ac21a6 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95building-mewui-apps
    Creates MewUI applications with proper setup, windows, theming, and controls. Use when starting a new MewUI project, understanding application lifecycle, using built-in controls, or styling with themes.
  • 95creating-mewui-controls
    Creates custom MewUI controls with proper measure, arrange, render, and input handling. Use when building new interactive controls, extending existing controls, or implementing custom rendering.
  • 100ui-be-binding-skill
    Use when binding backend/API data into an already-approved frontend UI without changing approved layout, copy, visual design, component hierarchy, or interaction states.
  • 100sapui5
    This skill should be used when developing SAP UI5 applications, including creating freestyle apps, Fiori Elements apps, custom controls, testing, data binding, OData integration, routing, and troubleshooting. Use when building enterprise web applications with SAP UI5 framework,…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.