Beispiel #1
0
        /* Note: This function has been added because a white-background was observed when the list resized,
         * when the number of elements were lesser than the maximum capacity of the list (ie. 4).
         * Binding Height/MaxHeight Properties did not solve this issue.
         */
        private void SuggestionList_UpdateListSize(object sender, Windows.UI.Xaml.Controls.ContainerContentChangingEventArgs e)
        {
            int count        = _viewModel?.Results?.Results.Count ?? 0;
            int displayCount = Math.Min(count, _settings.MaxResultsToShow);

            _resultList.Height = displayCount * ROW_HEIGHT;
        }
        private static void Target_ContainerContentChanging(Windows.UI.Xaml.Controls.ListViewBase sender, Windows.UI.Xaml.Controls.ContainerContentChangingEventArgs args)
        {
            var dispatcher = sender.Dispatcher;

            if (args.Item is IDeferInitialize updatable)
            {
                if (updatable.IsInitialized)
                {
                    return;
                }
                updatable.IsInitialized = true;

                _ = dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    updatable.DeferInitializeAsync();
                });


                // Handled = trueを指定すると、UIの描画が始まる模様
                // データ受信などが完了してない状態ではHandledを変更しない
                //args.Handled = true;
            }
        }
        private static async void Target_ContainerContentChanging(Windows.UI.Xaml.Controls.ListViewBase sender, Windows.UI.Xaml.Controls.ContainerContentChangingEventArgs args)
        {
            if (args.Item is IDeferInitialize updatable)
            {
                if (updatable.IsInitialized)
                {
                    return;
                }
                updatable.IsInitialized = true;
                await updatable.DeferInitializeAsync();

                // Handled = trueを指定すると、UIの描画が始まる模様
                // データ受信などが完了してない状態ではHandledを変更しない
                //args.Handled = true;
            }
        }