In my project after updating all nugets I get the error; Java.Lang.IllegalArgumentException: No view found for id 0x1 (unknown) for fragment FragmentContainer{b5b55d0 #2 id=0x1}. How can I solve it? App opens but when I click navigate to a page which contains listview, I get this error.
Java.Lang.IllegalArgumentException: No view found for id 0x1 (unknown) for fragment
Performance problem with scrollview
Hey guys!
I'm currently developping an application with xamarin in C# for ios and Android and I've come with performance issues.
I have 2 pages that are problematic but it may be for the same reason so to keep it simple I'll only use my first exemple.
So basically the page is only text, a couple paragraph and some images.
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5">
<Image Source="degrade_gris.png" Aspect="Fill" />
</Grid>
<Grid Grid.Row="0" Grid.Column="2" x:Name="Menu">
<Label x:Name="menu" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="Black" FontSize="Large" FontAttributes="Bold"/>
<ContentView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Grid.Row="0">
</ContentView>
</Grid>
<Grid Grid.Row="0" Grid.Column="1" x:Name="bars">
<Image Source="menu_icon.png"/>
<ContentView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<ContentView.GestureRecognizers>
<TapGestureRecognizer Tapped="OuvrirMenu"/>
</ContentView.GestureRecognizers>
</ContentView>
</Grid>
<Grid Grid.Row="0" Grid.Column="3">
<Image Source="home.png" x:Name="home"/>
<ContentView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<ContentView.GestureRecognizers>
<TapGestureRecognizer Tapped="Retour"/>
</ContentView.GestureRecognizers>
</ContentView>
</Grid>
<ScrollView BackgroundColor="#484848" Grid.Row="1" Grid.ColumnSpan="5">
<StackLayout Orientation="Vertical" BackgroundColor="#484848">
<Image Source="CRPD_blanc.png" HeightRequest="100" Margin="0,15,0,0"/>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" Margin="15">first paragraph.</Label>
<Image Source="icon_flag" HeightRequest="75" Margin="0,15,0,0"/>
<Label HorizontalTextAlignment="Center" TextColor="#B1B1B1" FontSize="Large" FontAttributes="Bold">MANDAT</Label>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" Margin="15">another paragraph</Label>
<Image Source="icon_story" HeightRequest="75" Margin="0,15,0,0"/>
<Label HorizontalTextAlignment="Center" TextColor="#B1B1B1" FontSize="Large" FontAttributes="Bold">HISTORIQUE</Label>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" FontAttributes="Bold" Margin="15">1997, « LE DÉBUT »</Label>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" Margin="15">
another paragraph
</Label>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" Margin="15">
another paragraph.
</Label>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" Margin="15">
another paragraph
</Label>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" Margin="15">
another paragraph
</Label>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" FontAttributes="Bold" Margin="15">2007, 10IÈME ANNIVERSAIRE DU COMITÉ</Label>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" Margin="15">
another paragraph
</Label>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" FontAttributes="Bold" Margin="15">2011, « POUR NE PAS PERDRE LE NORD »</Label>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" Margin="15">
another paragraph
</Label>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" FontAttributes="Bold" Margin="15">2018, « BEST BRO »</Label>
<Label HorizontalTextAlignment="Start" TextColor="#B1B1B1" Margin="15">
another paragraph
</Label>
<Image Source="icon_membres" HeightRequest="75" Margin="0,15,0,0"/>
<Label HorizontalTextAlignment="Center" TextColor="#B1B1B1" FontSize="Large" FontAttributes="Bold">MEMBRES DU COMITÉ</Label>
<Image Source="partenaire" Margin="15"/>
</StackLayout>
</ScrollView>
</Grid>
</ContentPage.Content>
I use a grid with 2 row and 5 column,
first row is the header, (button,title,button)
second row is columnspan 5 and is a scrollview with all my text.
Why does this lag so badly?
What does xamarin do in the background? it is as if it calculate labels wrapping on each frame.
Is this the right way to do it?
My other page have stacklayouts in stacklayouts, is this a problem?
Thank you!
WebView read and set cookies.
Hi there,
I am new to xamarin forms but not to c#.
But still...
I have made a website wrapper and i want to read/set cookies from the webview.
But where do I start, i read something about making a custom renderer but how does that work and is this still up2date?
fixed with/mono font
I have been trying to draw a label in fixed with font. How is this done?
This does not work:
<Label Text="P1" FontFamily="Generic Monospace">
There must be some font that is available on both Android and iOS right?
Add a data into the Listview
Hi,
I use navigation page to navigate from page A to page B.
Page B only contains a Entry When a users Enter a data in the Entry. The page is poped.
Now when popping page B, I would like for page A to receive the value selected in Page B and i want to show the data into the listview
how can i do that. Please let me know if anyone have this solution for this problem
In short:
1) NavigationPage
2) Navigate from page A to page B
3) Get the Value from user
4) return selected value from page B to page A
5)Value Display into listview
Thanks in advance!
Convert base64 string to PDF file
Hi there.
I have the scenario is below:
- A base 64 string (i catch from a webservice) that represents a PDF file
- I need convert that string to a PDF file, and open with the default PDF reader
- Must work for Android, iOS and UWP
Someone have a idea that how i do it, keywords or where to start?
Thanks.
Convert docX to PDF free
I'm trying to figure out how to convert a docX file that was downloaded as a byte stream and written to a file into a PDF so that I can open it using the PDFViewPage. I'd rather not pay for any packages. I tried Sautinsoft pdfmetamorphosis, but couldn't get that to work. All of their examples were for various Windows versions, and when attempting to compile I would get this error: System.IO.FileNotFoundException: Could not load assembly 'PdfMetamorphosis, Version=6.8.4.10, Culture=neutral, PublicKeyToken=f77041e5caa5fc2f'. Perhaps it doesn't exist in the Mono for Android profile? File name: 'PdfMetamorphosis.dll' Is this package meant for mobile?
Here's my code:
async void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
{
Publication p = (Publication)e.SelectedItem;
Debug.WriteLine(p);
if (p.folderID.Equals("-1"))
{
using (Stream respStream = await post(p.docNum))
{
string ext = p.appextension.ToLower();
byte[] buffer = new byte[respStream.Length];
respStream.Read(buffer, 0, buffer.Length);
string path = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/downloadedFile." + ext;
File.WriteAllBytes(path, buffer);
switch (ext)
{
case "pdf":
await Navigation.PushAsync(new PDFViewPage(path));
break;
case "docx":
//Convert docX at "path" to PDF here, then call "await Navigation.PushAsync(new PDFViewPage(path));"
//SautinSoft.PdfMetamorphosis converter = new SautinSoft.PdfMetamorphosis();
//string pdfPath = Path.ChangeExtension(path, ".pdf");
//converter.DocxToPdfConvertFile(path, pdfPath);
//await Navigation.PushAsync(new PDFViewPage(pdfPath));
await DisplayAlert("Error", ".docx files are not supported at this time", "Return");
break;
default:
Debug.WriteLine("wasn't pdf");
Debug.WriteLine("was a ." + ext);
break;
}
}
}
else
{
await Navigation.PushAsync(new PublicationsPage(p.folderID));
}
}
private async Task<Stream> post(string id)
{
Dictionary<string, string> dir = new Dictionary<string, string>();
dir.Add("LoginID", App.user.login_id);
dir.Add("docID", id);
var jsonReq = JsonConvert.SerializeObject(dir);
Debug.WriteLine("req: " + (String)jsonReq);
var content = new StringContent(jsonReq, Encoding.UTF8, "application/json");
var response = await client.PostAsync(url, content);
var responseString = await response.Content.ReadAsStreamAsync();
return responseString;
}
}
Font loading error based on platform
Hi,
I'm trying to follow the same code as found under Working With Fonts. Original:
label.Font = Device.OnPlatform(
iOS: Font.OfSize ("MarkerFelt-Thin", NamedSize.Medium),
Android: Font.OfSize ("Droid Sans Mono", NamedSize.Medium),
WinPhone: Font.OfSize ("Comic Sans MS", NamedSize.Medium)
);
My version:
public static class StyleGuide
{
public static Font SideMenuFont = Device.OnPlatform( iOS: Font.OfSize("Helvetica", 24));
}
The error I receive:
Error CS1502: The best overloaded method match for Xamarin.Forms.Device.OnPlatform(System.Action, System.Action, System.Action, System.Action)' has some invalid arguments (CS1502) Error CS1503: Argument
#1' cannot convert Xamarin.Forms.Font' expression to type
System.Action' (CS1503) (trkr)
I fail to see any difference compared to the guide here. Any ideas?
How to change background colour on select in navigational drawer in xamarin forms?
How to change background colour on select in navigational drawer in xamarin forms?
When I select Default color is == Orange
I want o change that color.
Placeholder Editor
How can I have a placeholder in an Editor in the same way as I can in an Entry field ?
Regards
BottomBar dll
I have integrated Bottom bar dll to shared code. I couldn't change bottom bar icons color or import to color icons. that icons are showing selected is a white color & not selected is a gray color.
anyone tell me how to change the icons color.
Editor Renderer
Hi ,
How To Remove The Editor Underline In Xamarin Android. Let Me Know If u have The solution for this.
Thanks,
How to increase quantity for selected listview buttons?
How to increase and decrease quantity for selected listview buttons.Here is the example
How to do this?
Getting error pages doesn't exist and warning about .net framework when using Rg.Plugins.Popup
I want to show popup in my app and add the package Rg.Plugins.Popup on all platforms
and
Xaml Code:
then getting the issues
Description
1) Warning: Package 'Rg.Plugins.Popup 1.0.4' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Steps to load the plugin with .NETStandard,Version=v2.0?
2) Error CS0234: The type or namespace name 'pages' does not exist in the namespace 'Xamarin.Forms' (are you missing an assembly reference?) (CS0234)
Steps to Reproduce
- Waring occurs when I add the NuGet package in my project for each platforms.
- Error occurs When I tried to build the app.
- Is this plugin support the below-mentioned configuration version
Xamarin.forms version 3.0.0.446417, Visual Studio (7.5.1) on mac,
.NET Core
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.0.5
2.0.3
2.0.0
SDK: /usr/local/share/dotnet/sdk/2.1.4/Sdks
SDK Versions:
2.1.4
2.0.3
2.0.0
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/msbuild/15.0/bin/Sdks
Apple Developer Tools
Xcode 9.3 (14154)
Build 9E145
Xamarin.iOS
Version: 11.10.1.178 (Visual Studio Community)
Hash: 408d3574
Branch: d15-7
Build date: 2018-05-08 18:56:30-0400
Xamarin.Android
Version: 8.3.0.19 (Visual Studio Community)
Android SDK: /Users/devmaran/Documents/android-sdk-macosx
Supported Android versions:
4.4 (API level 19)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 27.0.1
SDK Build Tools Version: 28 rc2
Java SDK: /usr
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
How to create Chat Application for Xamarin Forms ?
Hi, I am Xamarin Developer. I want to create chat application for Xamarin Forms. Is there any link ? Which sdk support to Xamarin forms ? Thank you
how to create chat app in xamarin form?
hi
how to create chat app in cross-platform xamarin? suggest me any sample code or video
How to develope chat application using xamarin.forms ?
How to develope chat application using xamarin.forms ?
Chat Application
Hi guys,
I'm trying to create a chat application on Xamarin Forms. I've been having problems with the UI. I have created a Renderer for the ViewCell however I've been having a problem with placing the Entry under the list. When the keyboard is open the list does not scroll up like it should.
1) Does anyone have a good Xamarin Forms chat example where the entry is at the bottom?
2) If I decide to implement the whole view natively for IOS and Android, can I bind the button to the ViewModel? How do I set the 'Command' property to a UIButton?
Thanks
Shaun
Picker within TableView?
I've got a simple form of mostly EntryCell values that works perfectly for a TableView with a Form intent. I'd also like to put a picker within the table to match the layout of the rest of the columns.
I can put a ViewCell and use a custom layout, but it just doesn't look quite right.
What is the right way to get a Picker added to a table so it follows the same layout as an entry cell with the label on the left and the picker on the right?
Picker in tableview causes viewcells to shrink
Sample:
return new ContentPage
{
Content = new TableView(new TableRoot
{
new TableSection("Textcell") {new TextCell {Text = "Text"}},
new TableSection("Viewcell with picker")
{
new ViewCell
{
View = new Picker
{
Items = {"1", "2", "3"},
Title = "Picker",
HorizontalOptions = LayoutOptions.FillAndExpand
}
}
},
new TableSection("Viewcell with button") {new ViewCell {View = new Button {Text = "button"}}}
}) {Intent = TableIntent.Data}
};
When you click the picker then select an item from the picker, when you return to the view the viewcells are cut off
Has anybody seen this before?