我正在开发一个应用程序,Flipview 控件在选择时有两个翻转视图项模板已更改(翻转视图)我需要获取翻转视图的选定索引是可能的。我试过这样
private void _fvDashboard_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int index=_fvDashboard.SelectedIndex;
if (index != -1)
{
if (_fvDashboard.SelectedIndex == 1)
{
btnScrBoard.Background = new SolidColorBrush(ColorHelper.FromArgb(255, 54, 54, 54));
btnItem2.Foreground = new SolidColorBrush(ColorHelper.FromArgb(255, 255, 255, 255));
btnItem1.Background = new SolidColorBrush(ColorHelper.FromArgb(255, 210, 222, 235));
btnItem1.Foreground = new SolidColorBrush(ColorHelper.FromArgb(255, 0, 0, 0));
_fvDashboard.SelectedIndex = 1;
}
else
{
btnItem1.Background = new SolidColorBrush(ColorHelper.FromArgb(255, 54, 54, 54));
btnItem1.Foreground = new SolidColorBrush(ColorHelper.FromArgb(255, 255, 255, 255));
btnItem2.Background = new SolidColorBrush(ColorHelper.FromArgb(255, 210, 222, 235));
btnItem2.Foreground = new SolidColorBrush(ColorHelper.FromArgb(255, 0, 0, 0));
_fvDashboard.SelectedIndex = 0;
}
}
}