Hi, does anyone know how to use compiled queries in Xamarin? I'm in the process of optimizing my app's Linq performance, while following this link: codeproject.com/Articles/38174/How-to-improve-your-LINQ-query-performance-by-X. Problem is, Xamarin doesn't recognize "System.Data.Linq".
Compiled Queries in Xamarin
ViewCell.ForceUpdateSize() not working?
Has anyone tried this yet? I've tried to use it in a custom ViewCell but it has no effect.
Scrollable Horizontal ListView in mcp.network
Hi,
I used mcpNetwork.Components for have a Horizontal scroll layout in xamrin.form how to control scroll in this component
i want to when select a record in Horizontal Scroll Layout as an item show in scroll thumb or scroll detector how can mange and show scroll thumb when touched it with programically for example access to this Method
public Task ScrollToAsync (double x, double y, bool animated)
source code : https://components.xamarin.com/view/hscroll
var dataHScroll2 = new HScrollViewCell2Data[] {
new HScrollViewCell2Data { id = 18, name = "Item 18", resetSelection = false, icon = "icon8.png"},
new HScrollViewCell2Data { id = 19, name = "Item 19", resetSelection = false, icon = "icon9.png"},
new HScrollViewCell2Data { id = 20, name = "Item 20", resetSelection = false, icon = "icon0.png"}
};
this.hscroll2 = new HorizontalScrollLayout
{
ItemSource = dataHScroll2,
ItemTemplate = new DataTemplate(typeof(HScrollViewCell2)),
HeightRequest = 60,
SelectionBackGroundColor = Color.Lime,
MultiSelection = true
};
this.hscroll2.ItemSelected += hscroll1And2_ItemSelected;
async void hscroll1And2_ItemSelected(object sender, HScrollEventArgs e)
{
HorizontalScrollLayout layout = (HorizontalScrollLayout)sender;
if (layout.Id.ToString() == this.hscroll1.Id.ToString())
{
HScrollViewCell1Data record = (HScrollViewCell1Data)e.Data;
if (record.shortSelectionTime)
{
await Task.Delay(250);
layout.UnselectItem(record);
}
}
if (layout.Id.ToString() == this.hscroll2.Id.ToString())
{
HScrollViewCell2Data record = (HScrollViewCell2Data)e.Data;
if (record.resetSelection)
{
await Task.Delay(250);
foreach (object selectedRecord in layout.SelectedItems)
{
layout.UnselectItem(selectedRecord);
}
}
}
}
Thanks
mcpNetwork.Components Horizontal scroll layout
Hi,
I used mcpNetwork.Components for have a Horizontal scroll layout in xamrin.form how to control scroll in this component
i want to when select a record in Horizontal Scroll Layout as an item show in scroll thumb or scroll detector how can mange and show scroll thumb when touched it with programically for example access to this Method
public Task ScrollToAsync (double x, double y, bool animated)
source code : https://components.xamarin.com/view/hscroll
var dataHScroll2 = new HScrollViewCell2Data[] {
new HScrollViewCell2Data { id = 18, name = "Item 18", resetSelection = false, icon = "icon8.png"},
new HScrollViewCell2Data { id = 19, name = "Item 19", resetSelection = false, icon = "icon9.png"},
new HScrollViewCell2Data { id = 20, name = "Item 20", resetSelection = false, icon = "icon0.png"}
};
this.hscroll2 = new HorizontalScrollLayout
{
ItemSource = dataHScroll2,
ItemTemplate = new DataTemplate(typeof(HScrollViewCell2)),
HeightRequest = 60,
SelectionBackGroundColor = Color.Lime,
MultiSelection = true
};
this.hscroll2.ItemSelected += hscroll1And2_ItemSelected;
async void hscroll1And2_ItemSelected(object sender, HScrollEventArgs e)
{
HorizontalScrollLayout layout = (HorizontalScrollLayout)sender;
if (layout.Id.ToString() == this.hscroll1.Id.ToString())
{
HScrollViewCell1Data record = (HScrollViewCell1Data)e.Data;
if (record.shortSelectionTime)
{
await Task.Delay(250);
layout.UnselectItem(record);
}
}
if (layout.Id.ToString() == this.hscroll2.Id.ToString())
{
HScrollViewCell2Data record = (HScrollViewCell2Data)e.Data;
if (record.resetSelection)
{
await Task.Delay(250);
foreach (object selectedRecord in layout.SelectedItems)
{
layout.UnselectItem(selectedRecord);
}
}
}
}
Thanks
Getting 'Invalid value for 'TargetFrameworkVersion'' error on Visual Studio 2015 in release mode iOS
We are getting ‘ Invalid value for 'TargetFrameworkVersion' ’ error when we are trying to publish iOS app. It is Xamarin Forms app. Both Mac and Windows have similar Xamarin version.
We have tried following things
• Setting GenerateManifests and also removing the following block
< PropertyGroup >
< GenerateManifests >true< / GenerateManifests >
< / PropertyGroup >
[ https://forums.xamarin.com/discussion/comment/35641/#Comment_35641 ]
• Turning off clickonce deployment
[ https://bugzilla.xamarin.com/show_bug.cgi?id=16594#c0 ]
• Removing TargetFrameworkVersion [ https://forums.xamarin.com/discussion/comment/35559/#Comment_35559 ]
We are able to deploy to simulators and devices. While create ipa for appstore, we are getting this issue.
Android GoogleMap resets camera to Rome
I have a MapRenderer that I'm editing directly:
` protected override void OnElementChanged(ElementChangedEventArgs e) {
base.OnElementChanged(e);
var gptMap = (GPTMap)e.NewElement;
if (gptMap != null) {
var mapView = (MapView)Control;
map = mapView.Map;
map.MapType = GoogleMap.MapTypeHybrid;
map.UiSettings.ZoomControlsEnabled = false;
}
}`
I add a marker to the map and set the camera as well to the same location:
map.MoveCamera(CameraUpdateFactory.NewLatLng(llArray[0]));
map.AddMarker(new MarkerOptions().SetPosition(llArray[0]).SetTitle("hi"));
For a fraction of a second, I see the map positioned over my marker, but then it jumps back to Rome. If I scroll manually back to the location of the marker, I see it is still there but for some reason the camera position seems to be overridden.
Does anyone have idea why this could happen? (Camera doesn't show user location and after setting the marker no other custom code is called on the map)
ProgressDialog pop up too late, trouble with threads and asyncs
I've Already wasted a day and half trying to work arround this problem.
Im trying to open a progressDialog when I press a button from a control(calendar) I've made.
When the user press the button the code sets some variables and then based on those, gets data from a ViewModel to fill my Control.
The problem comes when I try to create a ProgressDialog before running all the code.
I need to update my control visually and for this I try to run the code on the main thread.
But if i run the code on the main thread the ProgressDialog will only pop up after 1,5 second along with the update I just made to the interface and vanish right away.
async Task right_Clicked(object sender, EventArgs e)
{
if (OnCalendarChangeBegin != null)
OnCalendarChangeBegin(this); // THIS IS THE EVENT HANDLER THAT OPENS THE PROGRESSDIALOG
...
await RELOAD(7);
...
}
public async Task Reload(daysDifference)
{
// DIALOG WAS ALREADY OPEN IN HERE BUT ITS NOT SHOWN
this.StartDate = this.StartDate.AddDays(daysDifference);
var aux = days.Children;
ObservableCollection<DateTime> dataSource = new ObservableCollection<DateTime>();
DayLayout day;
Task myTask = Task.Factory.StartNew( () =>
{
dataSource = new ObservableCollection<DateTime>(App.Instance.FreeTimeSlotViewModel.DaysWithFreeSlots.Select(x => x.Date));
}).ContinueWith(_ =>
{
// THIS WORKS BUT THE DIALOG POPS UP TOO LATE
Device.BeginInvokeOnMainThread(() =>
{
for (int i = 0; i < aux.Count; i++)
{
day = ((DayLayout)aux[i]);
day.SetDate(daysDifference);
day.HasEvent = dataSource.Contains(day.DayDate.Date);
}
UpdateDaysUI(daysDifference, dataSource); // WILL UPDATE EACH DAY UI
OnCalendarChangeEnd(this); // EVENT HANDLER THAT HIDES THE PROGRESSDIALOG
SelectDay(StartDate);
});
//
});
await myTask;
}
When I try to remove it from the main thread it will open the PROGRESS DIALOG but it only updates the first day text,
All the other days will keep their previous value, and once i try to use the application it starts having black screens, labels, buttons vanish and it becomes unsuable. Its almost like I've crashed the thread but the app keeps running.
on my android
i just use this to show the ProgressDialog
[assembly: Xamarin.Forms.Dependency(typeof(ShowHud_Droid))]
namespace ...
{
public class ShowHud_Droid : IHud
{
public static ProgressDialog mDialog = new ProgressDialog(MainActivity.ctx);
public ShowHud_Droid()
{
mDialog = new ProgressDialog(MainActivity.ctx);
mDialog.Indeterminate = true;
}
public void ShowHud(string text)
{
try
{
mDialog.SetMessage(text);
mDialog.SetCancelable(true);
mDialog.Show();
return true;
}
catch (Exception e)
{
Console.WriteLine("Show HUD error: " + e.Message);
throw e;
}
}
Any idea what I should attempt next?
Let me know if you need more details.
thank you for your support
iOS MPMoviePlayerViewController goes blank after a few seconds
I'm having a weird issue with MPMoviePlayerViewController
.
public override void ViewDidLoad()
{
base.ViewDidLoad();
var f = new MPMoviePlayerViewController(NSUrl.FromString("http://www.w3schools.com/html/mov_bbb.mp4"));
f.MoviePlayer.ShouldAutoplay = true;
f.MoviePlayer.PrepareToPlay();
f.MoviePlayer.Play();
View.AddSubview(f.View);
}
After playback begins, the screen will go blank in a few seconds before the video finishes. Controls disappear as well. I tried using MPMoviePlayerController
, which worked fine except that the rotation point seems to be the center so when you go from portrait to landscape, the video goes out of the screen and comes back. MPMoviePlayerViewController
has built-in resizing on orientation change, but it's not working properly.
No Swipe Back when hiding Navigation Bar
I created a custom navigationbar. Works fine, only on iOS swipe back does not work. I'm trying to fix this with a custom render based on this thread: http://stackoverflow.com/questions/24710258/no-swipe-back-when-hiding-navigation-bar-in-uinavigationcontroller
This is my custom render:
[assembly: ExportRendererAttribute(typeof(BasePage), typeof(BasePageRenderer))]
namespace myapp
{
public class BasePageRenderer: PageRenderer, IUIGestureRecognizerDelegate
{
[Export("gestureRecognizerShouldBegin:")]
public bool ShouldBegin(UIGestureRecognizer recognizer)
{
if (recognizer is UIScreenEdgePanGestureRecognizer && NavigationController.ViewControllers.Length == 1)
{
return false;
}
return true;
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
NavigationController.InteractivePopGestureRecognizer.Delegate = this;
}
}
}
Somehow it crashes on this line: NavigationController.InteractivePopGestureRecognizer.Delegate = this;
Did someone implement this and got it working? Thanks.
First activity visible too long upon startup of Xamarin Forms app on Android
- Create a new Xamarin.Forms app
- Run your app on Android
- There is a delay of about 2 seconds after it launches MainActivity in the .Droid project and when it finally launches the Forms activity in the shared project.
- While waiting for the Forms activity to launch, the MainActivity file is empty and looks bad. It sits there for about 2 seconds. In this case, it's using the dark theme so there is a blue bar at the top, and a big black area below.
- What is the suggested action for that first activity that gets displayed before the Forms activity comes up? Should I populate it with a "Loading..." message? Is there a way to get it to speed up the loading of the Forms activity? What have other people done? I'm open to ideas.
How do I import the ToDo Sample into Visual Studio 2105 Community?
Beginners question I know, but I can go to https://github.com/xamarin/xamarin-forms-samples.git and open the ToDo sample, but how do I get the sample into Visual Studio? If I create a new Xamarin Forms solution in VS, do I replace the files it creates with the ones in GitHub? If so, how ... copy the file contents from GitHub and then open each file with Notepad and replace the contents?
I'm probably overlooking something simple, but I don't see a way to download the whole ToDo sample from GitHub and then run it in VS.
thanks
Where can I find the System default Icons fpr Menu bard for Windows 10 Mobile / Windows Phone
Hi,
For Android I got a full Icon pack. Is there a similiar Pack for MS Mobile devices?
Best
Thomas
XAML Designer does not work in Portable project
How should I design XAML UI's if the designer is not working in the Portable project?
I tried using Blend then copying the XAML, but Blend produces elements that will not run in Xamarin Forms Portable.
Thanks
System.Collections.Concurrent
I need to use a thread safe List. I was hoping to use the BlockingCollection in System.Collections.Concurrent but it does not seem to be available in Xamarin Forms PCL (targeting 4.5, iOS, Android & WinPhone).
Can anyone help. System.Collections.Concurrent is not an available reference.
Thanks in advance
Paul
CarouselPage and tabbedpage should be master pages?
I have details page and i would like split details in to 3 tabs. I see only examples where CarouselPage and TabbedPage are main pages defined in the app.cs. Can I not navigate from another page to CarouselPage ? and I can navigate from CarouselPage to any other page which is not defined inside CarouselPage or TabbedPage? If I can navigate how can I pass and object to each pages of the CarouselPage from another page?
Set Image on a Button or Image from Image source from Database
I know that the images are usually stared in Resources\drawable for Droid and Resources for ios. My question is is it possible to get an image from a database and set it to a button or an image without having it in the directory? Code sample would be nice.
How can I take the screenshot of the screen via Dependency Service in Xamarin.forms
I want to take the screenshot of the screen and created dependency service but everytime it goes to the native implementation current activity seems to appear as null.
Below is my code snippet :
var view = Activity.Window.DecorView;
view.DrawingCacheEnabled = true;
Bitmap bitmap = view.GetDrawingCache(true);
return bitmap;
Is there any way i can get current activity?
perchance xamrin component
Hi,
I try to purchance a xamrin component but I recive and error as follow bellow :
" we apologize but there was an error charging your balance ..... "
in ever request my charging be low as much as .5 dollar USD 10 $ --> 7 $ for now why ?
url :
https://components.xamarin.com/view/customnavpage?version=1.1.2
why ?
Thanks
What is the best way to show "Something went wrong" dialog?
This would be for iOS and Android. Currently, I'm using Insights to log all unhandled exceptions, but I have no way to alert the user that something went wrong. What's the best way to do this globally within each application? Basically, there would be some kind of alert with an OK button. When the user hits this button, the app would close.
Is it possible to use Acr.UseDialog with in Xamarin.forms?
Im working in Xamarin.Forms IOS ,Is it possible to use Acr.UserDialog with in Xamarin.Forms