在wpf的綁定中,我們會用到多值綁定,如下: 這裡如果 StringFormat="{3}({0}/{1}):{2}"這樣寫是不能通過編譯器的,解決方案是在前面加一組大括弧就可以了,如下: StringFormat="{}{3}({0}/{1}):{2}" 完整綁定如下: ... ...
在wpf的綁定中,我們會用到多值綁定,如下:
<MultiBinding Mode="OneWay" StringFormat="{3}({0}/{1}):{2}">
<Binding Path="CurIndex" Mode="OneWay"></Binding>
<Binding Path="TotalCount" Mode="OneWay"></Binding>
<Binding Path="CurName" Mode="OneWay"></Binding>
<Binding Path="AreaName" Mode="OneWay"></Binding>
</MultiBinding>
這裡如果
StringFormat="{3}({0}/{1}):{2}"這樣寫是不能通過編譯器的,解決方案是在前面加一組大括弧就可以了,如下:
StringFormat="{}{3}({0}/{1}):{2}"
完整綁定如下:
<TextBlock.Text>
<MultiBinding Mode="OneWay" StringFormat="{}{3}({0}/{1}):{2}">
<Binding Path="CurIndex" Mode="OneWay"></Binding>
<Binding Path="TotalCount" Mode="OneWay"></Binding>
<Binding Path="CurName" Mode="OneWay"></Binding>
<Binding Path="AreaName" Mode="OneWay"></Binding>
</MultiBinding>
</TextBlock.Text>