我有這樣的XAML ..基本上它連接了多個綁定到不同屬性的字符串。比方說,出於某種原因,我不想在VM上公開另一個屬性,將它作爲單個屬性。在Silverlight和TextBlocks中綁定時string.format的種類?
是否有任何其他XAML綁定的方式使它更緊湊?
<StackPanel Grid.Column="1" Orientation="Horizontal">
<TextBlock Text="Added by " FontSize="10" Foreground="#2C2C2C" />
<TextBlock Text="{Binding Document.MEMUser.UserName}" Foreground="#2C2C2C" FontSize="10" />
<TextBlock Text=" on " FontSize="10" Foreground="#2C2C2C"/>
<TextBlock Text="{Binding CreatedOn, Converter={StaticResource DateTimeToStringConverter}}" Foreground="#2C2C2C" FontSize="10" />
<!--BIND COMMANDS TO PARENT ViewModel to process operations-->
<Button Content="Delete" Command="{Binding DataContext.DeleteCommand, ElementName=LayoutRoot}" CommandParameter="{Binding}" />
<Button Content="Download" Command="{Binding DataContext.DownloadCommand, ElementName=LayoutRoot}" CommandParameter="{Binding}" />
</StackPanel>
應該 – katit
@katit:事實上,它應該,感謝您發現它。我現在編輯我的答案來糾正它。 –