ListViewItemの壊れた背景をUWPで削除するには?
I一部のアイテムでリストビューを作成しました。 1つをクリックすると、新しいページに移動します。 私は前のページに戻ります(メインメニューページ - >アイテムページ - >メインメニューへのFrame.GoBack()に戻る)と 最後にクリックしたアイテムの背景が灰色で表示されています。 背景を透明に設定しようとしましたが、動作しません。
デスクトップでは、この問題は存在しません。背景は黒です。 私はWindows 10でテストしています。RS2 & Windows 10 Mobile最後のインサイダービルドL640XL。
リストビュー:
<ListView Grid.Row="
Name="LineSecondTrackListView"
ItemsSource="{x:Bind _LineSecondTrackBusStops}"
ContainerContentChanging="SetBusStopViewAttribute"
ItemTemplate="{StaticResource BusStopListViewStyle}"
SelectionMode="Single"
SelectionChanged="LineTrackListView_SelectionChangedAsync">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid HorizontalAlignment="Center"
Orientation="Horizontal"
MaximumRowsOrColumns="1"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
どのようにバックアップしています:
public static void BackButtonPressed(object sender, BackRequestedEventArgs e)
{
Frame mainAppFrame = MainFrameHelper.GetMainFrame();
Type currentPageType = mainAppFrame.CurrentSourcePageType;
bool goBack = IsGoBackFromPageAllowed(currentPageType);
if (goBack)
{
mainAppFrame.GoBack();
e.Handled = true;
return;
}
App.Current.Exit();
}
private static bool IsGoBackFromPageAllowed(Type currentPageType)
{
if (currentPageType == typeof(Pages.Lines.LinesViewPage))
return true;
if (currentPageType == typeof(Pages.Lines.LinePage))
return true;
if (currentPageType == typeof(Pages.Lines.LineBusStopPage))
return true;
return false;
}
この影響を避けるために、どのように?
編集
私は
foreach (ListViewItem item in LineSecondTrackListView.Items)
VisualStateManager.GoToState(item, "Normal", false); //in the OnNavigatedTo
にしようと、それはメインメニューページで
EDIT2 仕事doesntの、私はボタンでクリックして戻って行った時、この効果はとどまります。すべてのページは、これらのいずれかがそれを修正しなかったNavigationCachePage=Required
EDIT3
ButtonListGridView.InvalidateMeasure();
ButtonListGridView.UpdateLayout();
ButtonListGridView.InvalidateArrange();
を持っています。
Background =#00FFFFFF – lindexi
NavigationCacheMode.EnabledまたはNavigationCacheMode.Requiredを使用してページをキャッシュしていますか?私は自分のアプリで同じ問題を抱えていますが、解決策はありません。 :/ –
おそらくforeach(LineSecondTrackListView.ItemsのListViewItem項目)を使用しています。VisualStateManager.GoToState(item、 "Normal"、false); OnNavigatedToメソッドのオーバーライドが役に立ちます。 (テストされていないので、数分前にこのアイデアを得ました。) –