Xaml MVVM在windows phone 8中不工作的点击事件
我正在尝试触发listbox项的点击事件并单击该项,但点击事件未触发,请帮助Xaml MVVM在windows phone 8中不工作的点击事件,xaml,windows-phone-8,windows-phone,Xaml,Windows Phone 8,Windows Phone,我正在尝试触发listbox项的点击事件并单击该项,但点击事件未触发,请帮助 <ListBox Margin="0,40,0,0" ItemsSource="{Binding Documents}" IsHitTestVisible="True" Width="450" VirtualizingStackPanel.VirtualizationMode="Recycling"> <ListBox.ItemsPan
<ListBox Margin="0,40,0,0"
ItemsSource="{Binding Documents}" IsHitTestVisible="True"
Width="450"
VirtualizingStackPanel.VirtualizationMode="Recycling">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="150" Margin="5"
Width="150" Background="Aqua">
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" HorizontalAlignment="Center" />
<i:Interaction.Triggers>
<i:EventTrigger EventName="Tap">
<commands:MvxEventToCommand Command="{Binding OpenFileCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
您确定事件永远不会被触发吗?也许你在外线窃听?Listbox项内容(本例中的网格)不会在整个Listbox宽度范围内拉伸,默认情况下它是左对齐的。若要确认,请尝试点击listbox项的最左侧区域,查看事件是否与此一起触发 假设问题是由listbox项内容未拉伸引起的,您可以尝试设置
HorizontalContentAlignment=“Stretch”
来解决该问题:
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
您确定事件永远不会被触发吗?也许你在外线窃听?Listbox项内容(本例中的网格)不会在整个Listbox宽度范围内拉伸,默认情况下它是左对齐的。若要确认,请尝试点击listbox项的最左侧区域,查看事件是否与此一起触发 假设问题是由listbox项内容未拉伸引起的,您可以尝试设置
HorizontalContentAlignment=“Stretch”
来解决该问题:
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
您确定事件永远不会被触发吗?也许你在外线窃听?Listbox项内容(本例中的网格)不会在整个Listbox宽度范围内拉伸,默认情况下它是左对齐的。若要确认,请尝试点击listbox项的最左侧区域,查看事件是否与此一起触发 假设问题是由listbox项内容未拉伸引起的,您可以尝试设置
HorizontalContentAlignment=“Stretch”
来解决该问题:
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
您确定事件永远不会被触发吗?也许你在外线窃听?Listbox项内容(本例中的网格)不会在整个Listbox宽度范围内拉伸,默认情况下它是左对齐的。若要确认,请尝试点击listbox项的最左侧区域,查看事件是否与此一起触发 假设问题是由listbox项内容未拉伸引起的,您可以尝试设置
HorizontalContentAlignment=“Stretch”
来解决该问题:
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
只是好奇这是否真的有效/无效。你能证实吗?只是好奇这是否真的有效/无效。你能证实吗?只是好奇这是否真的有效/无效。你能证实吗?只是好奇这是否真的有效/无效。你能证实吗?