luka
luka

Reputation: 637

WPF Mutibinding two or more binding on TextBlock Text

whe I build this style xaml code, gets back this error:

Severity Code Description Project File Line Suppression State Error A 'Binding' cannot be set on the 'Path' property of type 'Binding'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject

How I can multibinding this binding properties? thanks in advance.

 <Style x:Key="TextBlockLastUnitStyle" TargetType="TextBlock">
    <Setter Property="Text">
        <Setter.Value>
            <MultiBinding StringFormat="{}{0} : {1}">
                <Binding Path="{Binding String57, Source={StaticResource CurrentResources}}" />
                <Binding Path="{Binding LastUnitId,FallbackValue=-.-}" />
            </MultiBinding>
        </Setter.Value>
    </Setter>        
</Style>

Upvotes: 0

Views: 117

Answers (1)

atul goenka
atul goenka

Reputation: 157

The Bindings in a MultiBinding use XML tag syntax instead of attribute syntax:

<Style x:Key="TextBlockLastUnitStyle" TargetType="TextBlock">
    <Setter Property="Text">
        <Setter.Value>
            <MultiBinding StringFormat="{}{0} : {1}">
                <Binding Path="String57" Source="{StaticResource CurrentResources}"/>
                <Binding Path="LastUnitId" FallbackValue="-.-" />
            </MultiBinding>
        </Setter.Value>
    </Setter>
</Style>

Upvotes: 1

Related Questions