AvaloniaUI / avalonia-docs

https://docs.avaloniaui.net/docs/welcome
65 stars 213 forks source link

FuncValueConverter is yet missing from the docs. #301

Closed timunie closed 11 months ago

timunie commented 11 months ago
          FuncValueConverter is yet missing from the docs. Will add it once this is merged. 

draft:

## FuncValueConverter

You can also implement a `FuncValueConverter` if you don't need to convert back and also not the the `ConverterParameter`. The FuncValueConverter has two generic parameters:

**TIn**: This parameter defines the expected input type. This can also be an array in case you want to use this converter in a MultiBinding.

**TOut**: This parameter defines the expected output type.

### Example:
```cs
public static FuncValueConverter<string, string> MyConverter { get; } = new FuncValueConverter<string, string>(s => $"You said '{s}');
<!-- TODO -->


_Originally posted by @timunie in https://github.com/AvaloniaUI/Avalonia.Samples/issues/71#issuecomment-1869731748_