Skip to content

Commit 1f60663

Browse files
committed
Fix Translation Change Issue
1 parent 123f6a2 commit 1f60663

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

dev/Views/QuranTabViewItem.xaml.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ private void GetSurahFromDB()
163163
});
164164
}
165165

166-
public void GetSuraText(bool isTranslationAvailable = true)
166+
public void GetSuraText(bool isTranslationAvailable = true, int defaultItemIndex = -1)
167167
{
168168
DispatcherQueue.TryEnqueue(() =>
169169
{
@@ -187,6 +187,11 @@ public void GetSuraText(bool isTranslationAvailable = true)
187187
});
188188
}
189189
quranListView.ItemsSource = QuranCollection;
190+
191+
if (defaultItemIndex != -1)
192+
{
193+
ScrollIntoView(defaultItemIndex);
194+
}
190195
});
191196
}
192197

@@ -299,6 +304,10 @@ public void GoToListViewPreviousItem()
299304

300305
public void ScrollIntoView(int index)
301306
{
307+
if (index == -1)
308+
{
309+
return;
310+
}
302311
quranListView.SelectedIndex = index;
303312
quranListView.ScrollIntoView(quranListView.SelectedItem);
304313
}
@@ -656,8 +665,7 @@ private void CmbTranslation_SelectionChanged(object sender, SelectionChangedEven
656665
Settings.QuranTranslation = CurrentTranslation;
657666
CurrentQuranTranslation = CurrentTranslation;
658667
GetTranslationText();
659-
GetSuraText();
660-
ScrollIntoView(itemIndex);
668+
GetSuraText(true, itemIndex);
661669
}
662670
}
663671

0 commit comments

Comments
 (0)