Skip to content

Instantly share code, notes, and snippets.

@DamianSuess
Created August 28, 2024 20:02
Show Gist options
  • Save DamianSuess/0da57d63be8243b188a08cdd44a8b6eb to your computer and use it in GitHub Desktop.
Save DamianSuess/0da57d63be8243b188a08cdd44a8b6eb to your computer and use it in GitHub Desktop.
Avalonia-MultiBinding
<UserControl.Resources>
<ResourceDictionary>
<DataTemplate x:Key="FlatDeviceInfo" DataType="models:DeviceInfo">
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} - {1}">
<Binding Path="Address" />
<Binding Path="DeviceTypeName" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>
<!-- ... -->
<ComboBox IsTextSearchEnabled="True"
ItemTemplate="{StaticResource FlatDeviceInfo}"
Items="{Binding Devices}"
SelectedItem="{Binding DeviceSelected, Mode=TwoWay}" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment