devonserden
Topic Author
Posts: 1
Joined: 01 Nov 2023, 04:00

Create custom links in noesis

01 Nov 2023, 04:07

Hello, I need instructions on how to create custom bindings in Noesis to use in markup just like regular binding?

Thank you for supporting
 
User avatar
nadjibus
Posts: 33
Joined: 24 Feb 2022, 04:09

Re: Create custom links in noesis

01 Nov 2023, 14:28

You need to create a custom DependencyProperty?
public class YourUserControl : UserControl
{
    // Note: DependencyProperty should always have the name (Property name) + "Property" suffix:
    // (Test -> TestProperty, Value -> ValueProperty...
    public static readonly DependencyProperty TestProperty = DependencyProperty.Register(nameof(Test), typeof(YourUserControl), typeof(int));

    // Here's your current property you bind to in Xaml: Test = {Binding ViewModel.TestValue}
    public int Test
    {
        get => (int)GetValue(TestProperty );
        set => SetValue(TestProperty, value);
    }
}
Or you want to create your own {Binding ...} attribute? like {MyCustomBinding ...}? I don't think this is supported, but you can check Markup Extensions maybe this is what you're looking for.

Hint: If you don't find documentation/example code for a specific Noesis feature, Google it for WPF, Noesis and WPF are extremely similar, and you have high chances that the code you find for WPF will work in Noesis with little to no edit.

Who is online

Users browsing this forum: Google [Bot] and 0 guests