我正在使用FlipView
构建一个Photo应用程序。在BottomAppBar中,我放置了所有图像的ListView
以便能够在FlipView
中查看图像,当我在ListView
中单击它时,图像显示在ListView
(如分页)中选择的FlipView
中。在FlipView_SelectionChanged事件中设置ListView的selectedIndex
在listView.selectionChanged
事件中,当我在ListView
中选择它时,我制作了显示FlipView
中图像的代码。下面是代码:
private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
string CurrentViewState = ApplicationView.GetForCurrentView().Orientation.ToString();
int IndicatorIndex = listView.SelectedIndex;
GoToPage(CurrentViewState, IndicatorIndex);
}
private void GoToPage(string CurrentViewState, int IndicatorIndex)
{
if (CurrentViewState == "Portrait")
{
flipView1.SelectedIndex = IndicatorIndex;
}
else if (CurrentViewState == "Landscape")
{
if (IndicatorIndex % 2 == 0)
flipView1.SelectedIndex = IndicatorIndex/2;
else
{
if (IndicatorIndex == 1)
flipView1.SelectedIndex = 1;
else
flipView1.SelectedIndex = (IndicatorIndex + 1)/2;
}
}
}
现在,当我需要根据flipView.SelectedIndex
listView.SelectedIndex = flipView.SelectedIndex
我有一个异常改变listView.SelectedIndex
:
An exception of type 'System.ArgumentException' occurred in eBookApp.exe but was not handled in user code. Additional information: Value does not fall within the expected range.
我需要能够获得在FlipView
中选择的相同图像,并将其选中并滚动到ListView
...
请比“例外”更具体。你得到什么异常?什么是异常的确切错误信息?什么是异常堆栈跟踪?请提供可靠地重现问题的[良好,_minimal_,_complete_代码示例](http://stackoverflow.com/help/mcve),以及有关如何使用该代码示例重现问题的明确具体说明。 –
我试着编辑我的问题,我添加了我收到的异常消息和更多的代码,希望这是有帮助的! – yalematta