I am new to WPF. I have this code
<Window x:Class="ElementBinding.MultipleBindings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MultipleBindings" Height="320" Width="300">
<Grid>
<Slider Name="sliderFontSize" Margin="0,12,6,243"
Minimum="1" Maximum="40" Value="10"
TickFrequency="1" TickPlacement="TopLeft">
</Slider>
<TextBox Name="txtContent" Margin="0,44,0,208">Color should change here</TextBox>
<TextBlock Margin="3,150,3,3" Name="lblSampleText"
FontSize="{Binding ElementName=sliderFontSize, Path=Value}"
Text="{Binding ElementName=txtContent, Path=Text,Mode=TwoWay}"
Foreground="{Binding ElementName=lstColors, Path=SelectedItem.Tag}" >
Multiple Bindings
</TextBlock>
<ListBox Height="54" HorizontalAlignment="Left" Margin="12,90,0,0" Name="lstColors" VerticalAlignment="Top" Width="120" >
<ListBoxItem>Green</ListBoxItem>
<ListBoxItem>Red</ListBoxItem>
<ListBoxItem>Blue</ListBoxItem>
</ListBox>
</Grid>
</Window>
如果我选择名单上的一个项目,案文栏将不出现。 我认为问题在于选定项目。 页: 1 我如何解决这一问题?