When your own data page async void OnAppearing() Takes
This method is repeated for the number of data
private async void Switch_Toggled(object sender, ToggledEventArgs e)
Why go for this method?
I didn't click
When your own data page async void OnAppearing() Takes
This method is repeated for the number of data
private async void Switch_Toggled(object sender, ToggledEventArgs e)
Why go for this method?
I didn't click
I am trying to set the ItemsSource of a ListView from a nested ObservableCollection List. While HeaderGroups are being created, Items in the groups are empty. Any idea? Here is my code:
public class TableDataGroup { public TableDataGroup(String imagepath, String championship, String tip)//, Color headergroupbgcolor,) { this.ImagePath = imagepath; this.Championship = championship; this.Tip = tip; this.Items = new ObservableCollection<TableDataItem>(); } public string ImagePath { get; private set; } public string Championship { get; private set; } public string Tip { get; private set; } public ObservableCollection<TableDataItem> Items { get; set; } } public class TableDataItem { public TableDataItem(String imagepath, Color backgroundTipColour, String time, String teamone...) { this.ImagePath = imagepath; this.BackgroundTipColour = backgroundTipColour; this.Time = time; this.TeamOne = teamone; //... } public string ImagePath { get; private set; } public Color BackgroundTipColour { get; private set; } public string Time { get; private set; } public string TeamOne { get; private set; } //... }
Calls:
mainPageLoadViewModel.tableDataGroup = new ObservableCollection<TableDataGroup>(); for (int i = 0; i < 10; i++) { TableDataGroup tableDataGroup = new TableDataGroup("value", "value", "value","TIP"); for (int x = 0; x < 10; x++) { tableDataGroup.Items.Add(new TableDataItem("flag", backgroundtipcolor, time, teamone, //...)); } mainPageLoadViewModel.tableDataGroup.Add(tableDataGroup); } ItemsCollectionView.ItemsSource = mainPageLoadViewModel.tableDataGroup; `
xaml:
<ListView x:Name="ItemsCollectionView" ItemsSource="{Binding TableDataGroup}" IsGroupingEnabled="true" HasUnevenRows="True"> <ListView.GroupHeaderTemplate> <DataTemplate> <ViewCell> <ViewCell.View> <StackLayout BackgroundColor="DarkSlateGray" Orientation="Horizontal"> <StackLayout Padding="2" VerticalOptions="CenterAndExpand"> <Image Source="{Binding ImagePath}" HeightRequest="15" WidthRequest="15"/> </StackLayout> <StackLayout Padding="2" VerticalOptions="CenterAndExpand"> <Label Text="{Binding Championship}" FontSize="15" TextColor="White"/> </StackLayout> <StackLayout Margin="0,0,10,0" VerticalOptions="CenterAndExpand" HorizontalOptions="EndAndExpand"> <Label Text="TIP" FontSize="15" TextColor="White"/> </StackLayout> </StackLayout> </ViewCell.View> </ViewCell> </DataTemplate> </ListView.GroupHeaderTemplate> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <ViewCell.View> <Grid Padding="10,5,5,10" BackgroundColor="Gray"> <Grid.RowDefinitions> <RowDefinition Height="25" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="35"/> <ColumnDefinition Width="120"/> <ColumnDefinition Width="25"/> <ColumnDefinition Width="25"/> <ColumnDefinition Width="120"/> <ColumnDefinition Width="45"/> </Grid.ColumnDefinitions> <Label Text="{Binding Time}" Grid.Column="0" FontSize="13" TextColor="Black" VerticalTextAlignment="Center" HorizontalOptions="StartAndExpand"></Label> <Label Text="{Binding TeamOne}" FontSize="13" TextColor="Black" Grid.Column="1" VerticalTextAlignment="Center" HorizontalOptions="End"></Label> <Label Text="{Binding ScoreTeamOne}" FontSize="13" Grid.Column="2" BackgroundColor="Gray" TextColor="White" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" WidthRequest="25" MinimumWidthRequest="25"></Label> <Label Text="{Binding ScoreTeamTwo}" FontSize="13" Grid.Column="3" BackgroundColor="Gray" TextColor="White" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" WidthRequest="25" MinimumWidthRequest="25"></Label> <Label Text="{Binding TeamTwo}" FontSize="13" TextColor="Black" Grid.Column="4" VerticalTextAlignment="Center"></Label> <Label Text="{Binding Tip}" FontSize="13" TextColor="White" Grid.Column="5" BackgroundColor="DarkSlateGray" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" HorizontalOptions="Fill"></Label> </Grid> </ViewCell.View> </ViewCell> <!--<TextCell Text="{Binding Name}" Detail="{Binding Description}"></TextCell>--> </DataTemplate> </ListView.ItemTemplate> </ListView>
I updated app to Xamarin.Forms 4.5.0.356, also followed https://devblogs.microsoft.com/xamarin/uiwebview-deprecation-xamarin-forms/ , but still got ITMS-90809 warning.
I'm not using UIWebView in my project, but I guess the problem come from one from nugets, so could you advice me best way to check which one is problematic?
Hello,
We have created a simple Xamarin.Forms app. Testing is complete, and we are now deploying to the ~10 persons that will use it.
We have successfully deploy the Android and Windows Apps, but cannot get the IOS app deployed.
The environment:
VS.2019 C#
MacInCloud paired server.
12.9" iPad (iPadOS 13.5.1) to test with for first deployment.
We would like to engage someone for a 1-2 hour consultation to finalize this deployment.
Thanks.
Bryan Hunt
Hi All,
I am implementing firebase crashlytics for xamarin forms project.
I want to log non-fatal exceptions for my iOS project. Below is the code I am using to log non-fatal exceptions.
PCL:
try { User objUser = null; string username=objUser.Username; } catch (Exception ex) { firebaseTracker.LogException(ex); }
IOS:
public void LogException(Exception exception)
{
var crashInfo = new Dictionary<object, object>
{
[NSError.LocalizedDescriptionKey] = exception.Message,
["StackTrace"] = exception.StackTrace
};
var error = new NSError(new NSString(exception.GetType().FullName), -1001, NSDictionary.FromObjectsAndKeys(crashInfo.Values.ToArray(), crashInfo.Keys.ToArray(), crashInfo.Count)); Device.BeginInvokeOnMainThread(() => { Crashlytics.SharedInstance.RecordError(error); }); }
The code in PCL throws System.NullReferenceException: Object reference not set to an instance of an object.
Actual Result: This gets logged both under Crashes and Non-fatal section of firebase portal
Expected Result: This should get logged only under Non-fatal section of firebase portal
Note:[This is happening only for Null Reference exception. System.ArgumentOutOfRangeException gets logged only under non-fatal section(which is correct)]
Any help would be appreciated!
Thanks,
Payal
Need two command for entry TextChanged & UnFocused in listview using MVVM
I am looking for a good way to select a folder.
Currently, I've had great luck in selecting a file utilizing Xamarin.Plugin.FilePicker for; Android, iOS, and to my astonishment UWP.
Does anyone know how to get that to work as a Folder Picker or does anyone know of a good one out there?
Note:
No one wants to have a user try an select a file with Xamarin.Plugin.FilePicker and strip out the file name for 2 reasons: 1, that's lame and 2, they may not have a file in that folder and therefore unable to select (super lame).
Hello. I have a issue with the picker in Xamarin Android.
I need to unfocus picker. After selection, it stays focused. For most cases it is not the problem, but i'm writing an app for a barcode scanner. When I change selection, and don't touch the screen to unfocus manually, then when I perform scan, this Barcode is added into picker text. I tried to make focus to element which is not visible, but it is not allowed. Also I can't UnFocus picker because it would not allow me to make selection.
Issue is similar to the situation when you change selection in your picker and try to write something in Android Emulator. From the device you can't do it, keyboard is not enabled, but you can write to it using your computer keyboard.
Hi all, i created a nuget package for achieving video chat via OpenTok for Xamarin.Forms projects
By using Button in one shell. I want to navigate to another shell.
Hi all,
Some background on what I'm actually trying to achieve, in case what I think I should do isn't the best way to do it; within a Xamarin Forms app I'm developing, I want to be able to estimate distance travelled during a "journey" - to do that, I figured that the best way to do this (and I am happy to be corrected) would be that to "start" this journey would involve temporarily starting a service within the app in order to retrieve the user's geolocation every few seconds. It would do this until the user "stops" the service.
On Android, for this kind of thing, I would use a foreground service - something where the user can see a constant system notification that the app is still active and, if they don't want it to be continuing, they can easily stop it. The whole intention of this is to ensure that the user is aware, when looking at their device, that a process (geolocation requests) are still ongoing.
However, this needs to work with UWP as well (and probably iOS). I realise that I am describing an Android concept and I'm not really sure what differences (or analogous concepts) there are for iOS and, certainly, UWP applications. I am wondering if there is a cross-platform approach in Xamarin Forms to these kinds of system notifications, or if I should be really looking at a different way to go about this entirely..
Ultimately, what I am looking to achieve is:
I've only been using Xamarin Forms for a couple of months so far, so if I missed something that fully explains this, feel free to RTFM me with a link on this!
Thoughts and co. greatly appreciated!
I tried to save a file in uwp, but the access denied.
String fileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Record", "record.opml"); String dirName = Path.GetDirectoryName(fileName); if (!Directory.Exists(dirName)) Directory.CreateDirectory(dirName); if (!File.Exists(fileName)) File.Create(fileName); using (var streamWriter = new StreamWriter(fileName, true)) { streamWriter.WriteLine(doc); }
I have a CarouselView with ItemsSource bound to a collection of objects. Inside the view I have a DataTemplate with some layouts and eventually a custom control that has properties bound to properties of the objects in the collection. When I refresh my view the items in the list are refreshed, but my custom control is not recreated for each item. Specifically, I'm trying this scenario:
What I'm expecting is that when I refresh the view that my custom control will be recreated for each item in the refreshed list, but this is not what is happening. If I debug I can see that my custom control's constructor is only called the first time the view is created, but when I refresh it is not.
Why doesn't my custom control get recreated when the collection changes, or how can I make this happen? To clarify, when I refresh the collection I'm reloading data from the server and creating new instances of my model objects. So, the refreshed collection isn't a collection of the same objects, it's a collection of new objects.
Below is some relevant code. The controls:OfferControl
is my custom control that is not getting recreated when I refresh.
<CarouselView Position="{Binding Position}" HeightRequest="100" HorizontalScrollBarVisibility="Never" ItemsSource="{Binding OffersWithOrder}" PeekAreaInsets="16,0" VerticalOptions="FillAndExpand"> <CarouselView.ItemsLayout> <LinearItemsLayout ItemSpacing="10" Orientation="Horizontal" SnapPointsAlignment="Center" SnapPointsType="Mandatory" /> </CarouselView.ItemsLayout> <CarouselView.ItemTemplate> <DataTemplate x:DataType="viewmodels:OfferWithOrder"> <StackLayout Padding="0,8" Style="{DynamicResource StackVerticalNoPadding}"> <Frame BorderColor="{DynamicResource ColorPrimary}" Style="{DynamicResource FrameCarouselPanel}"> <controls:OfferControl Offer="{Binding Offer}" Order="{Binding Order}" /> </Frame> </StackLayout> </DataTemplate> </CarouselView.ItemTemplate> </CarouselView>
Hi,
As you can see in the image below when I press a button but I don't immediately release it, it creates this pink halo. I have already tried to change the background color or to look for this color in the whole project but I cannot remove it or change it. can anyone help me out?!
Hi all.
Any one know how to disable device back button in xamarin forms app?
Thanks
Lasantha
I have a website and now want to make iOS/Android APP to show content of my website. I plan to use Xamarin.Forms and WebView. The problem is, APP doesn't need to show as much as website, so I want to hide some elements of webpages. For example, there is an element whose id is "test", I want to use EvaluateJavaScriptAsync to hide it.
I tried
WebView WebSiteView = new WebView(); WebSiteView.Source = WebUrl; WebSiteView.EvaluateJavaScriptAsync("document.getElementById('test').style.display = 'none';");
But it doesn't work. Could someone tell me if this can work and how? Thanks.
Hello,
I've just come across a strange bug with the ListViews. Yesterday, I applied this fix https://devblogs.microsoft.com/xamarin/uiwebview-deprecation-xamarin-forms/ to send my app onto TestFlight which I am assuming might be the culprit as I do not recall seeing the bug before apply the above fix.
The bug looks as follows:
It looks as if there are multiple ListViews on top of one another but there are not.
Any help on this would be greatly appreciated.
Hi
Does Shell in Xamarin forms support Mac? i tried implementing it and can see only a blank screen.
Please suggest.
Regards.
Vinay
Hi.
Is there a way to set a checkbox in a listview as checked when the row in which this checkbox resides, is selected?
My listview:
<ListView x:Name="listViewSearchPO" SeparatorVisibility="Default" SelectionMode="Single" ItemSelected="ItemList_ItemSelected" >
The ItemList_ItemSelected event:
Something like:
`private void ItemList_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
foreach (CheckBox ch in listViewSearchPO.Items) { if(ch.Id.Equals(e.SelectedItemIndex)) { ch.IsChecked = true; } } }`
Friendly regards
nbs
So, now I have this problem too. I couldn't compile my project anymore, because InitializeComponent() isn't found.
What I use:
VS 2017 15.6.6 and Xamarin 4.9.0.753 (installed a day ago) on Windows 10
What I have done up to now:
Alone the last test costs a complete day
Nothing of this things work. And it is only with Xamarin.Forms iOS and UWP, sometimes Android. All other projects work without problems. And yes, a month ago I had no problems with the Xamarin.Forms project.
One strange thing is, that I asked someone else to clone the repository and try to compile it. There it works without problems. This leads to the assumption, that there is something strange with my PC.
Any suggestion, what I could delete, that I get up a running system, that could compile Xamarin.Forms projects?