I have a TextBlock with two MultiBindings. I'd like to make a user control out of this, as I need several instances. The only difference amongst the instances is the Name, and that is only needed as a sort of parameter to the MultiBinding.
<TextBlock x:Name="That"><
TextBlock.Foreground>
<MultiBinding Converter="{StaticResource multiValueFgColorConverter}">
<Binding ElementName="That" Path="Name" />
<Binding Path="TimerState" Mode="TwoWay" />
<Binding Path="Which" Mode="TwoWay" />
</MultiBinding>
</TextBlock.Foreground><TextBlock.Opacity>
<MultiBinding Converter="{StaticResource multiValueOpacityConverter}">
<Binding ElementName="That" Path="Name" />
<Binding Path="TimerState" Mode="TwoWay" />
<Binding Path="Which" Mode="TwoWay" />
</MultiBinding>
</TextBlock.Opacity><Bold><Run Text="That"/></Bold>
-- Is there a way to inject the Name in to an instance of the user control?
-- Or, perhaps wrap this user control in another control where it is used, and have the UC inherit the parent's name?
<grid x:Name="That">
<my:UC/> <!-- 'Inherits' "That"? -->
</grid>
-- Alternatively, is there a way to pass a string as a parameter to the MultiBinding? MultiBinding doesn't take ConverterParameters, as far as I know, so it has to be fudged through the Binding (although I am probably unaware of the better way...)
Thanks for any insights --