I have images on disk that I can display using an ImageSource
ImageSource.FromFile(filepath)
However, I now need to send that image to the server using HTTP, as a byte array. Any suggestions for getting started?
I have images on disk that I can display using an ImageSource
ImageSource.FromFile(filepath)
However, I now need to send that image to the server using HTTP, as a byte array. Any suggestions for getting started?
I have a Frame in which I use a TapGestureRecognizer to make the Frame act as a button. It functions correctly. Any suggestion for how can a give a 'button-like' animation so that it visually feels more like a button?
I understand I could change properties such that the text color/ background etc.. change for me but I'm trying to get more of a gradual gradient effect.
I am so happy the ForceUpdateSize() method on ViewCells was added a while ago. It allowed me to create a listview with rows that could be expanded and collapsed. However since I am using the MVVM pattern I have little direct control over my ViewCells. To get around this I created my own ViewCell (by imheritance) that listens to a "Collapsed/Expanded" event on my BindingContext (the bound ViewModel) for that cell. When the event is fired I call the ForceUpdateSize() on the viewcell (and change the height). This works great.
My problem now however is that I can't find a reliable way of telling when the ViewCell is no longer in use? I need this so I can unhook any event handlers from my ViewCell to it's BindingContext ViewModel. A method called "OnDisappearing" exists but it is not called when leaving the parent ContentPage (I think it might be called only when the ViewCell goes off screen or something when scrolling not sure though?).
How can I determine when to call my cleanup code inside a ViewCell?
Everything works previously, and now the app crashes.
System.NullReferenceException: Object reference not set to an instance of an object.
12-14 11:24:43.007 I/MonoDroid( 8814): at Xamarin.Forms.Platform.Android.AppCompat.Platform.LayoutRootPage (Xamarin.Forms.Page page, System.Int32 width, System.Int32 height) [0x0000c] in \agent_work\1\s\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:291
12-14 11:24:43.007 I/MonoDroid( 8814): at Xamarin.Forms.Platform.Android.AppCompat.Platform.Xamarin.Forms.Platform.Android.IPlatformLayout.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00003] in \agent_work\1\s\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:199
12-14 11:24:43.007 I/MonoDroid( 8814): at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x0000e] in \agent_work\1\s\Xamarin.Forms.Platform.Android\PlatformRenderer.cs:73
12-14 11:24:43.007 I/MonoDroid( 8814): at Android.Views.ViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x00008] in <75ed769cbb884df4b9e1d20f1afb8edf>:0
12-14 11:24:43.007 I/MonoDroid( 8814): at (wrapper dynamic-method) System.Object:19adb196-3a2d-4124-a1b9-5d9d132f51fa (intptr,intptr,bool,int,int,int,int)
12-14 11:24:43.043 W/art ( 8814): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
12-14 11:24:43.051 D/Mono ( 8814): DllImport searching in: '__Internal' ('(null)').
12-14 11:24:43.051 D/Mono ( 8814): Searching for 'java_interop_jnienv_throw'.
12-14 11:24:43.051 D/Mono ( 8814): Probing 'java_interop_jnienv_throw'.
12-14 11:24:43.052 D/Mono ( 8814): Found as 'java_interop_jnienv_throw'.
any ideas what happened?
something wrong with visual studio or my PC?
Using some of the animation provided by Xamarin I am able to cause elements to overlap each other, which is the desired effect. However in terms of which element is placed on top, it seems to give priority to last element added to the StackLayout. I cannot find a member of the 'Frame' Class that defines it's priority when being drawn. Any advice?
I get this error when starting new project right after create it (nothing changed) :
Severity Code Description Project File Line Suppression State
Error The "ResolveLibraryProjectImports" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'App2, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'App2.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) in /Users/builder/data/lanes/5749/9cfa7836/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:line 229
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName) in /Users/builder/data/lanes/5749/9cfa7836/source/xamarin-android/external/Java.Interop/src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil/DirectoryAssemblyResolver.cs:line 169
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection1 jars, ICollection
1 resolvedResourceDirectories, ICollection1 resolvedAssetDirectories, ICollection
1 resolvedEnvironments)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() App2.Android
This is Cross-platform Forms Xamarin project for IOS and Android with .NET Standard.
I'm trying to make a loop statement on the HorizontalOptions
of a CustomGrid, first I used switch
:
switch (HorizontalOptions)
{
case LayoutOptions.Start:
HorizontalOptions = LayoutOptions.End;
break;
default:
break;
}
but it says a constant value is expected (I feel I'm missing a very basic rule of C#!)
then I tried with if
statement:
if (HorizontalOptions == LayoutOptions.Start)
{
}
The error now is:
Operator '==' cannot be applied to operands of type 'LayoutOptions' and 'LayoutOptions'
Hi. I have fresh install of Visual Studio 2015 Professional and after click on File - New Project - Templates - Visual C# - Cross Platform I don't get any usual templates like Blank app or Cross Platform App (Xamarin.Forms or Native). I had installed all available items during Visual Studio installation and would like to target iPhone, Android and WF platform in a same project.
How to install missing templates?
Hi,
I am creating a page to display quotes.
The quotes must come randomly and change on very page load.
The quotes are coming from a json in the form of a list.
[{"QuoteNo":"2","Quote":"The life of a mother is the life of a child\u0026#58; you are two blossoms on a single branch","Author":"Karen Maezen Miller"},{"QuoteNo":"3","Quote":"You never understand life until it grows inside of you","Author":"Sandra C Kassis"}]
Please help.
Hi there
As far as I get, one of the solutions for the problem in the topic is the Badge.
I tried
https://github.com/B1naryStudio/Xamarin.Badge
and it works Ok showing the notification on the top of the screen rather than adding an icon.
How to display the icon (say, for Android), not the notification?
Thanks.
Hi, I', currently working with the last version of XF.
I'm developing a small app which use a WebView to show web pages coming from internet.
I'm facing some issues when the webview show certain pages. In the simulator everything is fine, but in the device, the content is "cut-off". Notice that the scroll bar somehow "know" that the page is far more longer than what is rendered cutted!
This is only happening on Android using XF and a WebView inside a content page.
If i create a simple Android "classic" app, with the webview inside a page, everything is fine!
Please help!
WRONG!
CORRECT
Hi there
How the Budge can get updated?
I do not understand where is that "polling" app code, which makes it updated?
Is it the server broadcast, not app polling?
Where to read more about its bolts and nuts?
Thanks.
Please help me I am new to Xamarin form, I want to bind to the properties of ICollection (Navigation Property). I tried many approaches it did not work for example I tried I need to do that for work any help will be appreciate. I am using MVVM helper plus James Montemagno grouping and used prism also
Thanks
Public Class Category{
public int ID {get;set;}
public string CatName {get;set;}
public virtual ICollection<Item> items {get;set;}
}
Public Class Item{
public Id {get;set;}
public Catname{get;set;}
public ItemName {get;set;}
Public virtual <SubItems> SubItems {get;set;}
}
Public Class SubItem{
public Id {get;set;}
public ItemName{get;set;}
public SubItemName {get;set;}
}
Public Class Expandable : BaseViewMdoel{
public Catagory CataGory{ get;set;}
public bool IsSelected {get;set;}
}
Public Class ExpandableListView : BaseViewModel{
public ObservableRangeCollection<Catagory> CollectionOfCatagory { get; } =
new ObservableRangeCollection<Catagory>();
public ObservableCollection<Grouping<Expandable ,Catagory>>SelectedCatagroy
{ get; set; } = new ObservableCollection<Grouping<Expandable, Catagory>>();
public DelegateCommand<Grouping<Expandable,Catagory>> HeaderCommand
{get
{
return new DelegateCommand<Grouping<Expandable , Catagory>>(g =>
{
if (g == null) return;
g.Key.IsSelected = !g.Key.IsSelected;
if (g.Key.IsSelected )
{
foreach (var item in CollectionOfCatagory )
{
var m = item.Catagory.Where(i => i.ID ==
g.Key.Catagory.ID);
foreach (var x in m)
{
g.Add(item);
}
}
}
else
{
g.Clear();
}
});
}
}
Void GroupListOfItem(){
var items = CollectionOfCatagory.Select(
x => new Expandable{ Catagory = x, IsSelected = false }
).GroupBy(c => new { c.Catagory.CatName}).Select(g =>
g.First()).ToList();
items.ForEach(c => SelectedCatagroy.Add(new
Grouping<Expandable, Catagory>(c, new
ObservableRangeCollection<Catagory>())));
}
}
My View :
<ListView ItemsSource="{Binding CollectionOfCatagory }"
IsGroupingEnabled="True">
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell>
<ContentView Padding="10,0,0,0">
<Label Text="{Binding Key.Catagory.CatName}"
VerticalOptions="Center"/>
<ContentView.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Source=
{x:Reference CatagoryListPage},
Path=BindingContext.HeaderCommand}" CommandParameter="
{Binding .}" />
</ContentView.GestureRecognizers>
</ContentView>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Padding="10,0,0,0">
<StackLayout Orientation="Horizontal">
<StackLayout WidthRequest="40">
<Label Text="{Binding Catname}" />
</StackLayout>
<Label Text = {Binding How To bind to properties of
navigation Please help}
</StackLayout>
<Image Source="Cat1"/>
</StackLayout>
</StackLayout>
</ViewCell>
Hi ,
I want to detail explanation for OnResume
Hi,
I am using the above plugin to select an image from the gallery and save it to the file system and path to the database. When I click on 'Browse' button, I get a dark screen and then app crashes. The code behind the button as follows:
async void butPickAPhoto_Clicked(object sender, System.EventArgs e)
{
if (!CrossMedia.Current.IsPickPhotoSupported)
{
await DisplayAlert("Photos Not Supported", ":( Permission not granted to photos.", "OK");
return;
}
var file = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions
{
PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium
});
if (file == null)
return;
imgSelected.Source = ImageSource.FromStream(() =>
{
var stream = file.GetStream();
file.Dispose();
return stream;
});
}
info.plist also updated.
Thank you for your advice.
Kamal
Hi,
I have a listview control in my form and by selecting an item, I navigate to another page that I would like to show the details record that related the the item.
I pass the object with my navigation but I don't know how to retrieve the data from the object. My code from Listview control looks like this:
void Gallery_ItemSelected(object sender, Xamarin.Forms.SelectedItemChangedEventArgs e)
{
var mi = e.SelectedItem as Models.muaGallery;
Navigation.PushAsync(new PhotoGalleryItemSetup() {BindingContext = mi});
}
Thank you for your help and advise.
Kamal
I have a ListView with around 10-15 items in it. Each item has an image. When viewing the list on an iphone you can only see around 4-5 rows at a time.
When I scroll down the list, the rows that move out of the view lose their image when I scroll back to them again.
How can i stop this or reset the image once the rows comes back into view?
Hi,
I need to disable Dictation button on keyboard in Xamarin forms, I am not very sure how to implement this.
Do I have to implement CustomRenderer for Entry and override any behavior?
Any suggestions would be greatly appreciated.
Thank you,
Vinod
The display alert Message shows twice on xamarin forms application.don't know why?Is it a known bug ?
Please find a solution to solve this issue.
I need to validate if a Position (Latitude, Longitude) is inside of a polygone that I drew on my map, I know I can do this with the Geometry Library of google maps, but I don't know how to apply it into my Xamarin Forms project, I only founded the description to do it in Javascript at the offcial google maps documentation, Please help!