xamarin


Why is my listview showing the item source data type?


I'm not looking for a solution here, for I believe there's nothing that you can guys can gather to what's causing this in my specific case. But I was wondering if anyone has any insight at all as to what may be making this happen. We have 8K+ users daily. This issue only seems to affect a small percentage of our users, and seems to happen on wifi only. But essentially, this is what they see:
So it's showing the path of the item source of the list view. Instead of the layout it's supposed to show. The layout is pretty complicated so I won't post it initially, but if anyone wants to see it then I'll surely post it here too. Just really looking for insights here. It seems to only happen when we're showing images, (we have an alternative listview for users that don't want to see images).
UPDATE (CustomGridCell)
Here's my layout:
ImageFrame = new XamarinMobile.CustomRenderers.ExtendedFrame();
FrameContainer = new Xamarin.Forms.AbsoluteLayout();
ImageAndOverlayContainer = new Xamarin.Forms.AbsoluteLayout();
ShowReadOverlay = new Xamarin.Forms.BoxView();
headline = new Xamarin.Forms.Label();
headline.VerticalOptions = Xamarin.Forms.LayoutOptions.Center;
headline.HorizontalOptions = Xamarin.Forms.LayoutOptions.StartAndExpand;
headline.TranslationX = 0;
headline.TextColor = App.IsDarkThemeEnabled() ? Xamarin.Forms.Color.White : Xamarin.Forms.Color.Black;
headline.FontSize = App.IsLargeTextEnabled() ? App.NormalizeFontSize(20) : App.NormalizeFontSize(16);
loadingMoreStories = new Xamarin.Forms.Label();
loadingMoreStories.VerticalOptions = Xamarin.Forms.LayoutOptions.Center;
loadingMoreStories.HorizontalOptions = Xamarin.Forms.LayoutOptions.StartAndExpand;
loadingMoreStories.TranslationX = 0;
loadingMoreStories.TextColor = App.IsDarkThemeEnabled() ? Xamarin.Forms.Color.White : Xamarin.Forms.Color.Black;
loadingMoreStories.FontSize = App.IsLargeTextEnabled() ? App.NormalizeFontSize(20) : App.NormalizeFontSize(16);
publishDate = new Xamarin.Forms.Label();
publishDate.VerticalOptions = Xamarin.Forms.LayoutOptions.Center;
publishDate.HorizontalOptions = Xamarin.Forms.LayoutOptions.StartAndExpand;
publishDate.TranslationX = 0;
publishDate.TextColor = App.IsDarkThemeEnabled() ? Xamarin.Forms.Color.White : Xamarin.Forms.Color.Gray;
publishDate.FontSize = App.IsLargeTextEnabled() ? App.NormalizeFontSize(16) : App.NormalizeFontSize(12);
cellImage = new Xamarin.Forms.Image();
loadingText = new Xamarin.Forms.Label();
loadingText.Text = "Loading...";
loadingText.TextColor = App.IsDarkThemeEnabled() ? Xamarin.Forms.Color.White : Xamarin.Forms.Color.Gray;
GoogleAdView = new Xamarin.Forms.ContentView();
activityIndicator = new Xamarin.Forms.ActivityIndicator()
{
IsEnabled = false,
IsRunning = false,
Color = Xamarin.Forms.Color.Red
};
GoogleAd = new Controls.Ad();
GoogleAdView.Content = GoogleAd;
GoogleAd.AdFailed = (r) =>
{
};
GoogleAd.AdReturned = (r) =>
{
};
layout = new Xamarin.Forms.Grid();
AdContainer = new Xamarin.Forms.Grid();
LoadingLayout = new Xamarin.Forms.StackLayout()
{
VerticalOptions = Xamarin.Forms.LayoutOptions.Center,
BackgroundColor = Xamarin.Forms.Color.Transparent,
HorizontalOptions = App.Settings.SettingsValues.GridListView ? Xamarin.Forms.LayoutOptions.Start : Xamarin.Forms.LayoutOptions.Center,
Orientation = Xamarin.Forms.StackOrientation.Vertical,
Children =
{
headline,
publishDate,
loadingMoreStories
}
};
layout.RowDefinitions.Add(new Xamarin.Forms.RowDefinition { Height = new Xamarin.Forms.GridLength(1, Xamarin.Forms.GridUnitType.Star) });
layout.ColumnDefinitions.Add(new Xamarin.Forms.ColumnDefinition { Width = new Xamarin.Forms.GridLength(1, Xamarin.Forms.GridUnitType.Star) });
layout.Children.Add(loadingText, 0, 0);
//Facebook Ads
FacebookAdContainer = new Xamarin.Forms.StackLayout();
FacebookAd = new Controls.FacebookAd();
FacebookAd.PlacementId = $"{App.FacebookPlacementId}";
FacebookAd.VerticalOptions = Xamarin.Forms.LayoutOptions.CenterAndExpand;
FacebookAd.Page = MobileObjects.Enums.PageType.Grid;
FacebookAdContainer.Children.Add(FacebookAd);
AdContainer.Children.Add(GoogleAdView, 0, 0);
AdContainer.Children.Add(FacebookAdContainer, 0, 0);
layout.Children.Add(AdContainer, 0, 0);
//ugh, we need to do an image frame because thats the only way (that I know of) to add a border on an image. We need this if the image is older than x, because they no longer have borders.
ImageFrame.Padding = new Xamarin.Forms.Thickness(0);
ShowReadOverlay.HeightRequest = 0;
ImageAndOverlayContainer.Children.Add(cellImage);
ImageAndOverlayContainer.Children.Add(ShowReadOverlay);
ImageFrame.Content = ImageAndOverlayContainer;
ImageFrame.HasShadow = false;
FrameContainer.HorizontalOptions = Xamarin.Forms.LayoutOptions.CenterAndExpand;
FrameContainer.Children.Add(ImageFrame);
layout.Children.Add(FrameContainer, 0, 0);
layout.Children.Add(ShowReadOverlay, 0, 0);
layout.Children.Add(LoadingLayout, 0, 0);
loadingText.HorizontalOptions = Xamarin.Forms.LayoutOptions.CenterAndExpand;
loadingText.VerticalOptions = Xamarin.Forms.LayoutOptions.CenterAndExpand;
cellImage.HorizontalOptions = Xamarin.Forms.LayoutOptions.CenterAndExpand;
cellImage.VerticalOptions = Xamarin.Forms.LayoutOptions.CenterAndExpand;
if (!hasLoadedAdAtLeastOnce)
{
hasLoadedAdAtLeastOnce = true;
}
layout.Padding = new Xamarin.Forms.Thickness(App.HorizontalGridPadding);
LoadingLayout.WidthRequest = 280;
GoogleAdView.Content.HorizontalOptions = Xamarin.Forms.LayoutOptions.Center;
View = layout;
UPDATE 2 (How it's wired)
foreach (MobileObjects.GridListStory story in stories.StoryList)
{
index++;
//if (index % (adLocation + 1) == 0 && index != stories.StoryList.Count)
if (index == _firstadlocation + 1)
{
PhoneCells.Add(new ViewModels.GridCellViewModel { Image = string.Empty, HasRead = false, Headline = "Loading Ad...", PublishDate = string.Empty, ActivityIndicator = new Xamarin.Forms.ActivityIndicator(), IsAd = true, ShowFacebookAd = App.Settings.SettingsValues.AdNetwork == MobileObjects.Enums.AdNetwork.facebook, rawCellIndex = index, collectionIndex = 0, numberOfStories = stories.StoryList.Count, LoadPageDate = LoadPageDate, StoryId = 0, IsEndOfGrid = IsEndOfGrid });
_numberOfAds++;
}
else
{
if (_subsequentadlocation != 0 && index != _subsequentadlocation && index != _firstadlocation && ((index - (_firstadlocation)) % _subsequentadlocation == 0) && (index != stories.StoryList.Count || index != stories.StoryList.Count - 1))
{
PhoneCells.Add(new ViewModels.GridCellViewModel { Image = string.Empty, HasRead = false, Headline = "Loading Ad...", PublishDate = string.Empty, ActivityIndicator = new Xamarin.Forms.ActivityIndicator(), IsAd = true, ShowFacebookAd = App.Settings.SettingsValues.AdNetwork == MobileObjects.Enums.AdNetwork.facebook, rawCellIndex = index, collectionIndex = 0, numberOfStories = stories.StoryList.Count, LoadPageDate = LoadPageDate, StoryId = 0, IsEndOfGrid = IsEndOfGrid });
_numberOfAds++;
}
}
try
{
ViewModels.GridCellViewModel newCell = new ViewModels.GridCellViewModel { Image = story.SquareImageURL, ImageWidth = story.SquareWidth, HasRead = story.ReadStory, Headline = story.Headline, PublishDate = story.AddedDateString, ActivityIndicator = new Xamarin.Forms.ActivityIndicator(), IsAd = false, rawCellIndex = index, collectionIndex = _index, numberOfStories = stories.StoryList.Count, LoadPageDate = LoadPageDate, StoryId = story.StoryId, IsEndOfGrid = IsEndOfGrid };
PhoneCells.Add(newCell);
//we could set these properties in the view model object above, but to make it easier to maintain, we're using a controller which will be the endpoint for any time we want to mark a story as read.
XamarinMobile.Controllers.SIRController.ChangeBGColor(story.ReadStory, PhoneCells[PhoneCells.Count - 1]);
XamarinMobile.Controllers.SIRController.ChangeTextColor(story.ReadStory, PhoneCells[PhoneCells.Count - 1]);
}
catch (System.Exception ex)
{
var j = ex;
}
_index++;
if (index == stories.StoryList.Count)
{
_lastStoryIdOfGrid = story.StoryId;
}
}
PhoneCells.Add(new ViewModels.GridCellViewModel { Image = string.Empty, HasRead = false, Headline = string.Empty, PublishDate = string.Empty, ActivityIndicator = new Xamarin.Forms.ActivityIndicator(), IsAd = false, collectionIndex = 0, rawCellIndex = stories.StoryList.Count + 1, numberOfStories = stories.StoryList.Count, LoadPageDate = LoadPageDate, StoryId = 0, IsEndOfGrid = IsEndOfGrid });
SetUpGridNumberAndName();
_navigatingToPage = false;
Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
{
gridList.IsVisible = true;
gridList.ItemTemplate = new DataTemplate(typeof(Classes.CustomGridCell));
gridList.ItemsSource = PhoneCells;
App.GridCells = PhoneCells;
var adCells = PhoneCells.Where(x => x.IsAd);
if (adCells != null)
{
App.GridAdCells = new System.Collections.ObjectModel.ObservableCollection<ViewModels.GridCellViewModel>(adCells.ToList());
}
});
UPDATE 3 (GridCellViewModel)
public class GridCellViewModel : System.ComponentModel.INotifyPropertyChanged
{
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
private Xamarin.Forms.Color _backgroundColor;
public Xamarin.Forms.Color BackgroundColor
{
get { return _backgroundColor; }
set
{
if(HasRead)
{
_backgroundColor = value;
} else
{
_backgroundColor = Xamarin.Forms.Color.Transparent;
}
PropertyChanged?.Invoke(this, new System.ComponentModel.PropertyChangedEventArgs("BackgroundColor"));
}
}
private Xamarin.Forms.Color _textColor;
public Xamarin.Forms.Color TextColor
{
get { return _textColor; }
set
{
if (HasRead)
{
_textColor = value;
}
else
{
if(App.IsDarkThemeEnabled())
{
_textColor = Xamarin.Forms.Color.White;
} else
{
_textColor = Xamarin.Forms.Color.Black;
}
}
PropertyChanged?.Invoke(this, new System.ComponentModel.PropertyChangedEventArgs("TextColor"));
}
}
public string Image { get; set; }
public string Headline { get; set; }
public string PublishDate { get; set; }
public Xamarin.Forms.ActivityIndicator ActivityIndicator { get; set; }
public bool IsAd { get; set; }
public bool HasRead { get; set; }
public bool AdHasLoaded { get; set; } = false;
public int collectionIndex { get; set; }
public int rawCellIndex { get; set; }
public int numberOfStories { get; set; }
public DateTime LoadPageDate { get; set; }
public int StoryId { get; set; }
public bool IsEndOfGrid { get; set; }
//next 2 properties only used for tablets
public int ImageWidth { get; set; }
public int ImageHeight { get; set; }
private Guid _adIdentification = Guid.NewGuid();
public Guid AdIdentification
{
get
{
return _adIdentification;
}
}
private MobileObjects.Enums.AdNetwork _adNetwork;
public MobileObjects.Enums.AdNetwork AdNetwork
{
get
{
return App.Settings.SettingsValues.AdNetwork;
}
}
private bool _showFacebookAd = true;
public bool ShowFacebookAd
{
get { return _showFacebookAd; }
set
{
_showFacebookAd = value;
PropertyChanged?.Invoke(this, new System.ComponentModel.PropertyChangedEventArgs("ShowFacebookAd"));
}
}
private bool _showGoogleAd = false;
public bool ShowGoogleAd
{
get { return _showGoogleAd; }
set
{
if (value == true)
{
//attempt to load ad???
}
_showGoogleAd = value;
PropertyChanged?.Invoke(this, new System.ComponentModel.PropertyChangedEventArgs("ShowGoogleAd"));
}
}

Related Links

xamarin forms ios tabbed page
Xamarin deploy error
Memory leak occurs only on ios 10.x devices, but fine on ios 9.3
Xamarin iOS RefreshControl is stuck
Xamarin: How to remove unwanted packages which is dependent from removed package
Opening Xamarin app out of memory is very slow
“XamlCTask” task failed unexpectedly" error when building with the new Xamarin Forms
when i run an app it open for a short seconded then close instantly. i am working in xamarin
Local notification AlertAction always null in Xamarin iOS
Map showing grid in xamarin ios
Xamarin.Realm issue - runtime skipping lines
Xamarin Studio lost intellisense after update , how to fix it?
How to create custom speedometer image in Xamarin
Debug mode not working on Visual studio mac preview
Missing Android version in Visual Studio after installing SDK
How to highlight ListView selected item in Xamarin.Forms without using codebehind?

Categories

HOME
wso2-am
variables
hive
pypi
reserved
relayjs
fme
vmware
cplex
spagobi
spring-cloud-stream
dxl
sql-server-2016
angular-ui-bootstrap
windows-server
opengl-es-2.0
bs4
nano-server
ups
decimal
serverless-framework
workload-scheduler
shared-hosting
conemu
riot.js
ehcache
sylius
excel-2007
buildbot
tooltipster
linkerd
elasticsearch-ruby
vision
subdomains
google-cloud-nl
flink-streaming
media-queries
nameservers
junit5
xquery-3.0
jspresso
catch-all
wixsharp
http-digest
xcode-extension
webix-treetable
eclipse-scout
elmah
mime
google-datalayer
rainbowtable
pango
python-c-api
fancybox-2
tizen-native-app
mu
tropo
aurelia-validation
carrot
slickedit
directory-structure
dtexec
ifs
color-profile
vtigercrm
quartz-composer
topbeat
home-directory
thrust
lua-5.1
actionbardrawertoggle
sdf
yaws
associative-array
ios8-today-widget
ruby-2.2
django-unittest
tmuxinator
iiviewdeckcontroller
android-radiobutton
jquery-layout
valueconverter
rtmfp
openlaszlo
flexmojos
geos
sitemesh
yui-compressor
jelly
distutils
word-processor
newtonscript
dbproviderfactories
xdomainrequest
mysql-error-1005
gamequery
infrastructure
firefox-5
virtual-functions
w3wp

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile