At the moment, I have two very large DataTemplate objects to display two sets of items in two ListBoxes. DataTemplates are referenced in the ContentTemplate property in two styles that are specified in the ItemContainerStyle properties of the two ListBoxes. Elements of the same type and DataTemplates are identical, with the exception of the following control:
From DataTemplate1
<TextBlock Style="{StaticResource TextStyle}" FontSize="20" Foreground="White"
HorizontalAlignment="Left" Panel.ZIndex="2" Text="{Binding RemainingTime.TotalHours,
Converter={StaticResource DoubleToIntegerConverter}, StringFormat={}{0:#00}}" />
From DataTemplate2
<TextBlock Style="{StaticResource TextStyle}" FontSize="20" Foreground="White"
HorizontalAlignment="Left" Panel.ZIndex="2" Text="{Binding ElapsedTime.TotalHours,
Converter={StaticResource DoubleToIntegerConverter}, StringFormat={}{0:#00}}" />
Is there any way to avoid duplicating the entire Dataemplate, but still has this one difference from the text binding of this TextBlock in the second template?
source
share