Implements advanced WPF data binding patterns including MultiBinding, PriorityBinding, and complex converters. Use when combining multiple values, fallback values, or implementing complex binding scenarios.
View on GitHubchristian289/dotnet-with-claudecode
wpf-dev-pack
January 23, 2026
Select agents to install to:
npx add-skill https://github.com/christian289/dotnet-with-claudecode/blob/main/wpf-dev-pack/skills/advanced-data-binding/SKILL.md -a claude-code --skill advanced-data-bindingInstallation paths:
.claude/skills/advanced-data-binding/# WPF Advanced Data Binding
## 1. MultiBinding
`MultiBinding` is used to combine multiple source values into a single binding target.
### 1.1 Basic Pattern
```xml
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} {1}">
<Binding Path="FirstName"/>
<Binding Path="LastName"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
```
### 1.2 With IMultiValueConverter
```csharp
public sealed class FullNameConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length < 2 ||
values[0] is not string firstName ||
values[1] is not string lastName)
{
return DependencyProperty.UnsetValue;
}
return $"{firstName} {lastName}";
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
```
```xml
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource FullNameConverter}">
<Binding Path="FirstName"/>
<Binding Path="LastName"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
```
### 1.3 Boolean Logic with MultiBinding
```csharp
public sealed class AllTrueConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
return values.All(v => v is true);
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
```
```xml
<!-- Enable button only when all conditions are true -->
<Button Content="Submit">
<Button.IsEnabled>
<MultiBinding Converter="{StaticResource AllTrueConverter}">
<Binding Path="IsFormValid"/>
<Binding Path="IsNotBusy"/>
<Binding Path="Ha