我正在开发一款win 8应用程序。我在datatemlate中有一个带有combobox的列表视图。现在当我滚动listview时出现问题,当滚动listview组合框selectedValueChanged事件时,组合框丢失了selectedvalue。
<ListView x:Name="lstQuestion" Margin="0 10 0 0" SelectionMode="None"
ItemsSource="{Binding QuestionsViewModel.AuditQuestionList}" IsItemClickEnabled="True" >
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Margin="10 0 0 0">
<TextBlock Text="{Binding QuestionText}" Padding="14,10,10,10" FontSize="14" TextWrapping="Wrap"/>
<StackPanel Orientation="Horizontal">
<Rectangle ToolTipService.ToolTip="{Binding QuestionText}" x:Name="rectAnswerColor" Fill="{Binding ProgressColor, Converter={StaticResource HexToSolidColorConverter}}" Width="5" Height="40"/>
<ComboBox x:Name="cmbanswer" Margin="10 0 0 0" Height="40" HorizontalAlignment="Left" Width="200" ItemsSource="{Binding PossibleAnswerList}" Visibility="{Binding QuestionType, Converter={StaticResource IntToVisibility1}}" SelectionChanged="cmbanswer_SelectionChanged_1" />
<TextBox x:Name="txtAnswer" Margin="10 0 0 0" Height="40" Width="200" Visibility="{Binding QuestionType, Converter={StaticResource IntToVisibility2}}" LostFocus="txtAnswer_LostFocus_1"/>
<Image x:Name="imgcamera" Source="/Assets/camera.png" Height="35" Width="30" Margin="15 0 0 0" Tapped="imgcamera_Tapped_1"/>
<Border x:Name="brdBackground" Margin="-8 -20 0 0" Background="Red" CornerRadius="10" Height="22" Width="22" >
<TextBlock x:Name="tblImageCount" Text="+" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="12"/>
</Border>
<Image x:Name="imgnote" Source="/Assets/notepad.png" Height="30" Width="30" Margin="15 0 0 0" Tapped="imgnote_Tapped"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
有什么问题吗?
答案 0 :(得分:0)
尝试在ComboBox.IsDropDownOpen == true
时禁用ListView的滚动属性答案 1 :(得分:0)
我为listview添加了一个scrollviewer,它可以工作。滚动时列表视图发生的事情,重绘不可见的项目或其他东西。无论如何,谢谢你的回复。