如何在Silverlight 3中實現MultiBinding?Silverlight 3中的MultiBinding 3
3
A
回答
3
這裏有一個稍微不同的工作原理的實現:http://www.olsonsoft.com/blogs/stefanolson/post/Improvements-to-Silverlight-Multi-binding-support.aspx 它可以讓你寫這樣的代碼:
<TextBlock x:Name="Block" Foreground="White" FontSize="13"
Margin="5,0,0,0">
<local:BindingUtil.MultiBindings>
<local:MultiBindings>
<local:MultiBinding TargetProperty="Text" Converter="{StaticResource TitleConverter}">
<Binding Path="Surname"/>
<Binding Path="Forename"/>
</local:MultiBinding>
<local:MultiBinding TargetProperty="Visibility" Converter="{StaticResource TitleToVisibiltyConverter}">
<Binding Path="Surname"/>
<Binding Path="Forename"/>
</local:MultiBinding>
</local:MultiBindings>
</local:BindingUtil.MultiBindings>
</TextBlock>
通常我不喜歡鏈接到人們的博客,但代碼太大而無法發佈。
0
這裏有一個實現,允許多達5個綁定:http://www.thejoyofcode.com/MultiBinding_for_Silverlight_3.aspx 它可以讓你寫這樣的代碼:
<binding:MultiBinding x:Name="mb" Converter="{StaticResource intsToBrushConverter}"
NumberOfInputs="3"
Input1="{Binding ElementName=red, Path=Value, Mode=TwoWay}"
Input2="{Binding ElementName=green, Path=Value, Mode=TwoWay}"
Input3="{Binding ElementName=blue, Path=Value, Mode=TwoWay}" />
<Border Background="{Binding ElementName=mb, Path=Output}" Margin="5"/>
相關問題
- 1. Silverlight 3中的ImageButton?
- 2. Silverlight 3中的Caliburn和datatetes 3
- 3. Silverlight 3 Beta,NavigationService中的ViewModel
- 4. Silverlight 3託管
- 5. 登錄Silverlight 3
- 6. 在Silverlight 3
- 7. Silverlight 3 Toolkit - ListBoxDragDropTarget
- 8. Silverlight 3&Deeplinking
- 9. Silverlight 3和IMultiValueConverter
- 10. Silverlight 3 Treeview
- 11. Silverlight 3類庫
- 12. Silverlight 3的導航
- 13. Silverlight 3和Silverlight 4共存
- 14. Silverlight 3中收集結合
- 15. 在Silverlight 3中替代TypeDescriptor?
- 16. 在silverlight中創建圖3
- 17. Silverlight 3 TabItem Positioning Error
- 18. Silverlight 3 WriteableBitmap問題
- 19. silverlight入門3 mvvm
- 20. Silverlight 3 DataGrid - 圓角
- 21. Silverlight 3替代FileVersionInfo.GetVersionInfo
- 22. Silverlight 3 + DataGrid.SelectedItems問題
- 23. Silverlight 3 IValueConverter麻煩
- 24. Silverlight 3 - 3D引擎
- 25. Silverlight 3和Silverlight 4有條件的xaml
- 26. Silverlight 3的進度模板
- 27. 找不到Silverlight 3的System.Windows.Controls.dll
- 28. Silverlight 3的AutocompleteBox.text不更新
- 29. Silverlight 3的XamlReader異常
- 30. 的Silverlight(3)最佳實踐