我已經指定ListBox
的內容是一個對象列表。如何綁定到wpf列表框中的所有項目並指定轉換器?
<telerik:RadListBox x:Name="listViewTakeOffConfigurations"
ItemsSource="{Binding EstimateTakeoffService.EstimatingTakeOffConfigurations}" >
的ItemTemplate
設置像這樣:
<telerik:RadListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Path=FontName}" />
<TextBlock Grid.Column="1" Text="Sample" FontFamily="{Binding FontName}" Foreground="{Binding Path=FontColour, Converter={StaticResource hexColorToBrushConverter}}" FontSize="{Binding Path=FontSize}" FontStyle="{Binding Path=SelectedItem, Converter={StaticResource estimatingTakeOffConfigurationToFontStyleConverter}, Mode=OneWay}" VerticalAlignment="Centre" Margin="5,0,0,0"/>
</Grid>
</DataTemplate>
</telerik:RadListBox.ItemTemplate>
我在第二個文本框與fontstyle的一個問題。我希望它綁定到列表框中的每個項目,這將涉及到我設置一個像{binding}這樣的綁定,但是這不允許我添加一個轉換器,所以fontstyle將不會被設置。
有沒有人有任何建議?
感謝
能否請您提供更多infomration你想用FontStyle做什麼?我們在哪裏應用它?我們應該從轉換器轉換成什麼? – AlSki