Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example of using MultiBinding with Built-in converters #611

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion docs/reference/built-in-data-binding-converters.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,27 @@ This example binding will hide the text block if its bound text is null or empty
Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
```

And this example will hide the content control if the bound object is null or empty:
This example will hide the content control if the bound object is null or empty:

```xml
<ContentControl Content="{Binding MyContent}"
IsVisible="{Binding MyContent,
Converter={x:Static ObjectConverters.IsNotNull}}"/>
```

And this example demonstrates binding to multiple bound parameters. It will show the text block if the `MyText` property of the bound object is not null or empty and the `IsMyNotEmptyTextVisible` property is set to `true`:

```xml
<TextBlock Text="{Binding MyText, StringFormat='My text: {0}'}">
<TextBlock.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="MyText" Converter="{x:Static StringConverters.IsNotNullOrEmpty}"/>
<Binding Path="IsMyNotEmptyTextVisible"/>
</MultiBinding>
</TextBlock.IsVisible>
</TextBlock>
```

## More Information


Expand Down
Loading