Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 91519 articles
Browse latest View live

Async method using RestSharp

$
0
0

Hi Guys,

I'm building a simple app that mainly is being build using Xamarin Forms. It is a shared project solution. In my app there is a news page displaying the news item using the List function from Xamarin Forms. I got this working on iOS and Android. Windows Phone fails because my first method wasn't ASYNC. Now i have created two methods that has to created a list based on the results from RestSharp. The problem is that i cannot get this thing working using the async method. Does anyone has an idea what i am doing wrong?

    public IRestClient client = new RestClient("http://api.logini-dev.nl/v1/");
    public static List<Newsitem> GetNewsItems()
    {


        //var client = new RestClient("http://api.logini-dev.nl/v1/");

        var request = new RestRequest("news/feed/format/json", Method.GET);
        request.OnBeforeDeserialization = resp => { resp.ContentType = "application/json"; };
        request.RequestFormat = DataFormat.Json;


       // IRestResponse response = client.Execute(request);
       // var content = response.Content; // raw content as string

        IRestResponse restResponse = await client.ExecuteTask(request);

        RestSharp.Deserializers.JsonDeserializer deserial = new JsonDeserializer();
        //var data = deserial.Deserialize<List<Newsitem>>(response);

        return data;
    }

    public static async Task<IRestResponse> ExecuteTask(this IRestClient client, RestRequest request)
    {
        var TaskCompletionSource = new TaskCompletionSource<IRestResponse>();
        client.ExecuteAsync(request, (response, asyncHandle) =>
        {
            if (response.ResponseStatus == ResponseStatus.Error)
                TaskCompletionSource.SetException(response.ErrorException);
            else
                TaskCompletionSource.SetResult(response);
        });
        //IRestResponse returnData = TaskCompletionSource.Task.Result;
        return TaskCompletionSource.Task;
        //return returnData;
    }

Thanks in regards!


Weird error when building for WP

$
0
0

Hello, somehow Xamarin.Forms.Platform.iOS gets involved when I try to compile my app for WP

[quote]
Severity Code Description Project File Line Suppression State
Error Cannot resolve dependency to assembly 'Xamarin.Forms.Platform.iOS, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event. MyApp.WinPhone Y:\Prosjekter\Xamarin Prosjekter\MyApp\ MyApp\MyApp.WinPhone\App.xaml 1
[/qoute]

Checkbox - Xamarin Forms does not have even Checkboxes ?!

$
0
0

I am really frustrated now. I've begin a hard transition from Delphi to Xamarin, but finally it turns out that Xamarin Forms is some sort of void of controls.
There is some fragments written freely as open source but nothing seriously supported, and the worse of all - it lack basic controls like CheckBoxes , Radio Buttons and so on and on.
Is this correct or I am doing something wrong ?!

How to get System.Globalization.CultureInfo.OptionalCalendars to have > one entry on Android and iOS

$
0
0

I make use of CultureInfo.OptionalCalendars in order to support both Gregorian calendars and others, such as the Hijri and Hebrew calendars.
On Windows platforms (UWP desktop, UWP phone, WinRT 8.1, WinPhone 8.1 RT) I find the expected calendars available in CultureInfo.OptionalCalendars.

However, on Android and iOS devices, OptionalCalendars only ever contains one calendar. Can anybody tell me what I need to do in order to get more than one calendar in the OptionalCalendars collection ?

Button ContentLayout OnPlatform

$
0
0

Hi,

in my Xamarin.Forms cross-platform project I'm using a Button with Text and Icon.
The attribut <ContentLayout="Right,100"> works fine on Android but I want to change the Value on iOS.

So I try something like that:

 <Button.ContentLayout>
                    <OnPlatform x:TypeArguments="???"
                                        Android="Right,100"
                                        WinPhone="Right,100"
                                        iOS="Right,50" />
 </Button.ContentLayout>

But I don't know what to insert as TypeArgument? I'm often on this problem and have to google what to insert here. Is there any overview with all TypeArguments?

Btw. is it correct that WinPhone can't handle this attribut? because even with <ContentLayout="Right,100"> it's align the items from left not from right and with ugly spacing between.

Evolve 2016 App Android Project build but does not deploy to Device

$
0
0

Hi guys I'm trying to debug the Evolve App using Visual Studio 2015.
I have built all the relevant projects successfully but when I go to debug I get an error.
I looked into the error and found that it has to do with the jarsigner and the debug.keystore
I'm relatively new to Xamarin so my knowledge of the keystore is quite limited but I understand that it is used to sign an app during development.
I have looked in the file specified and there is no file.
Do I have to give the app the keystore a alias and password manually or am I missing a debug.keystore completely?
Apologies if I'm totally off the mark here as I'm still getting familiar with Xamarin.

here is the stack trace:

jarsigner error: java.lang.RuntimeException: keystore load: C:\Users\dummy\AppData\Local\Xamarin\Mono for Android\debug.keystore (The system cannot find the path specified)

Any help would be greatly appreciated
Thanks

View, HttpClient and webapi calls

$
0
0

Hi guys,
I should ask an advice. I'm creating an internal application for my company and I've implemented a synchronization procedure. This procedure read all records from the application database and send them to the main server. There are a lot of tables. I want to show a progressbar and a text to inform the user what the application is doing.

For that I have a View with the progressbar and textbox, a ViewModel to update the Progress value in the progressbar and the text. In this ViewModel I'm calling another function: this function is a web client (HttpClient) to send to my webapi all records. For each important event (Network error, update status, sync done and so on) this function raises a event that the ViewModel receives this event and update itself and then the view.

Generally speaking all the process is working but... the view is very fast and it doesn't show the message step by step. I mean when I call the webapi with async. The main procedure opens a lot of instance against the client function and in background the application calls the webapi.

Then I inserted for each call to an async function .ConfigureAwait(false) but I didn't notice a real difference.

Sometimes I received an error

System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143

and the application is freezing.

Then my question is: what is the best way to manage this kind of activities? Thank you in advance for your help.

Styling the menu in FreshMvvm's master detail page layout.

$
0
0

Hi, does anybody know if it is possible to style the menu in Fresh Mvvm's master detail page layout. I currently can add menu items by using:

FreshMasterDetailNavigationContainer masterDetailNav = new FreshMasterDetailNavigationContainer();
 masterDetailNav.Init("Menu", "Menu.png");
 masterDetailNav.AddPage<LoginPageViewModel>("Login", null);
 masterDetailNav.AddPage<UsersPageViewModel>("Users", null);
 MainPage = masterDetailNav;

That gives me a menu with the list of menu items but I would like to add the following:

  1. An image at the top of the menu before the menu items. Similar to a banner.
  2. A toolbar to the bottom where I could put some icons for settings, about, etc..

Is it possible to do something like the following (Spotify's menu):

Thanks


Hijri datepicker in Xamarin PCL

$
0
0

Hello Everyone,
We need a datepicker in Hijri however Xamarin PCL datepicker control does not have CalendarType so please share any brilliant idea, how to have hijri datepicker. I also did search and there are few other threads with same question, but no one have verified answer.

So please suggest any brilliant idea. Thank you.

Deployment failed. Architecture not supported.

$
0
0

Hi

I am getting the below error while deploying..

The package does not support the device architecture (x86). You can change the supported architectures in the Android Build section of the Project Options.

Deployment failed. Architecture not supported.

TapGestureRecognizer not firing for Android

$
0
0

TapGestureRecognizer is working for WinPhone but on Android although the Application Output is showing [ViewRootImpl] ViewPostImeInputStage ACTION_DOWN but the Tapped evenit isn't being called...

        var listGestureRecognizer = new TapGestureRecognizer();
        listGestureRecognizer.Tapped += (s, e) =>
        {
    //do something...
        };
        listArea.GestureRecognizers.Add(listGestureRecognizer);

Any suggestions...

stuck in problem while creating GPS Service to get Latitude,Longitude of current Device position

$
0
0

I'm trying to have Geolocation Control on my Android device and applied the following steps:->
1. Add the Xam.Plugin.Geolocator in both Portable and .droid project
2. Enable two Android permissions: ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION.
3. Include Library: using Plugin.Geolocator;
4. Write an asychronous method named "OnGPSButtonClicked";
async void OnGPSButtonClicked(object sender, EventArgs e)
{
try
{
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;

                                var position = await locator.GetPositionAsync (timeoutMilliseconds: 10000);

                                Console.WriteLine ("Position Status: {0}", position.Timestamp);
                                Console.WriteLine ("Position Latitude: {0}", position.Latitude);
                                Console.WriteLine ("Position Longitude: {0}", position.Longitude);
                            }
                            catch(Exception ex)
                            {
                                Debug.WriteLine("Unable to get location, may need to increase timeout: " + ex);
                            }
                        }

5. Add the following code in AssemblyInfo.cs under .droid project :->
[assembly: UsesFeature("android.hardware.location", Required = false)]
[assembly: UsesFeature("android.hardware.location.gps", Required = false)]
[assembly: UsesFeature("android.hardware.location.network", Required = false)]

After running this code, it run upto "locator.DesiredAccuracy = 50;" then I got the exception, I print it on my output Console:

System.Threading.Tasks.TaskCanceledException: A task was canceled.

06-03 13:11:38.382 I/mono-stdout( 3284): System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0002d] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:193
06-03 13:11:38.383 I/mono-stdout( 3284): at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0002d] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:193
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
06-03 13:11:38.385 I/mono-stdout( 3284): at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
06-03 13:11:38.387 I/mono-stdout( 3284): at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable

1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:580
06-03 13:11:38.388 I/mono-stdout( 3284):   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable
1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:580
at Plugin.Geolocator.GeolocatorImplementation+d__27.MoveNext () [0x00597] in C:\projects\xamarin-plugins\Geolocator\Geolocator\Geolocator.Plugin.Android\GeolocatorImplementation.cs:175
06-03 13:11:38.389 I/mono-stdout( 3284): at Plugin.Geolocator.GeolocatorImplementation+d__27.MoveNext () [0x00597] in C:\projects\xamarin-plugins\Geolocator\Geolocator\Geolocator.Plugin.Android\GeolocatorImplementation.cs:175
--- End of stack trace from previous location where exception was thrown ---
06-03 13:11:38.390 I/mono-stdout( 3284): --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00027] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:190
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
at System.Runtime.CompilerServices.TaskAwaiter
1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:372
  at WeatherApp4.WeatherDetails+<OnGPSButtonClicked>d__22.MoveNext () [0x000a4] in C:\********\Desktop\WeatherApp4\WeatherApp4\WeatherApp4\WeatherDetails.xaml.cs:285
[0:] System.Threading.Tasks.TaskCanceledException: A task was canceled.
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0002d] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:193
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable
1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:580
at Plugin.Geolocator.GeolocatorImplementation+d__27.MoveNext () [0x00597] in C:\projects\xamarin-plugins\Geolocator\Geolocator\Geolocator.Plugin.Android\GeolocatorImplementation.cs:175
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00027] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:190
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
at System.Runtime.CompilerServices.TaskAwaiter
1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:372
  at WeatherApp4.WeatherDetails+<OnGPSButtonClicked>d__22.MoveNext () [0x000a4] in C:\*******\Desktop\WeatherApp4\WeatherApp4\WeatherApp4\WeatherDetails.xaml.cs:285
The exception is end
[0:] The exception is end
06-03 13:11:38.392 I/mono-stdout( 3284):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
06-03 13:11:38.393 I/mono-stdout( 3284):   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00027] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:190
06-03 13:11:38.394 I/mono-stdout( 3284):   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170
06-03 13:11:38.394 I/mono-stdout( 3284):   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142
06-03 13:11:38.395 I/mono-stdout( 3284):   at System.Runtime.CompilerServices.TaskAwaiter
1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:372
06-03 13:11:38.395 I/mono-stdout( 3284): at WeatherApp4.WeatherDetails+d__22.MoveNext () [0x000a4] in C:******\Desktop\WeatherApp4\WeatherApp4\WeatherApp4\WeatherDetails.xaml.cs:285

I'm not able to get it. Can any body provide me any solution.

How to call PropertyChanged on base class

$
0
0

Have followed the excellent guide for having labeled section heads in a ListView in Xamarin Forms from :-

https://github.com/xamarin/xamarin-forms-samples/tree/master/LabelledSectionsList/LabelledSectionsList/LabelledSectionsList

I wanted to use the same viewmodel in another area of the app related to this list view but am having trouble with one aspect,triggering property changed even in the base class that implements INotifyPropertyChanged

public class TradeViewModel : ObservableCollection
{
public string TradeId { get; set; }
public string TradeDescription { get; set; }

    bool _selected;
    public bool Selected
    {
        get
        {
            return _selected;
        }
        set
        {
            _selected = value;
    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); // cant do this as its declared in base class.
        }
    }

If i don't do this i need to keep copying the the data back and forth between models with is a pain, cant seem to find a way to invoke a property changed method in base class, and ObservableCollection doesn't seem to have NotifyPropertyChanged method. Have tried writing an extension for ObservableCollection but not had much luck.

Any ideas ?

thanks
Neil

I got "Could not find 7zip.exe in xamarin installation" error

$
0
0

Hi all,
Does anyone know what to do? This error only occur in the IOS version of my xamarin.forms project.
Everything was running fine until I installed nuget package for WindowsAzure.MobileServices (Microsoft.Bcl,Microsoft.Bcl.Build,Microsoft.Net.Http)

Even If I remove those packages, I've got this error...

How to create directory and file in the root folder of internal storage ?

$
0
0

My need is to accept few text data and save it into a xml file. Later it should be easy for the user to locate and transfer that xml file or files to his computer. So i am trying to create a directory into root of phone's internal storage, I tried executing following code but it throws exception.

var dirToCreate = System.IO.Path.Combine(Android.OS.Environment.RootDirectory.AbsolutePath, "MyFolder");
if (!System.IO.Directory.Exists(dirToCreate))
System.IO.Directory.CreateDirectory(dirToCreate);

System.UnauthorizedAccessException: Access to the path "/system/MyFolder" is denied.

Please Advice.


MessagingCenter subscription not reacting in UWP

$
0
0

Has anyone ever used MessagingCenter in UWP? For me, it's not reacting at all...

This is where I subscribe:

MessagingCenter.Subscribe<AddGroupPageViewModel, ChatDto> (this, "ChatCreated", (sender, chatDto) => {
    Device.BeginInvokeOnMainThread (() => {
        this.CurrentPage = this.Children [0];
        ChatsPhonePage chatPhonePage = this.CurrentPage as ChatsPhonePage;
        CurrentPageViewModel.SelectedChatListItem = CurrentPageViewModel.Chats.FirstOrDefault(c => c.chatId == chatDto.chatId);
        chatPhonePage.Handle_ItemTapped (null, new ItemTappedEventArgs (null, chatDto));

    });
});

And this is where I send:

private void OnWebsocketProcessMessage(AntwortDto antwortDto)
{
    if (antwortDto.socketevent == SocketEventsEnm.CHAT_CREATE.Name)
    {
        IsBusy = false;
        NavigationParameters parameters = new NavigationParameters();
        parameters.Add(ChatsPhonePageViewModel.NAVPARAMKEY_REFRESH, true);
        Device.BeginInvokeOnMainThread(async () =>
            {
                ChatDto chatDto = await JsonParser.ParseChatDtoAsync (antwortDto.data.ToString ());
                if (Device.Idiom == TargetIdiom.Tablet || Device.Idiom == TargetIdiom.Desktop)
                {
                    await _navigationService.GoBackAsync(parameters);
                }
                else
                {
                    await _navigationService.GoBackAsync(parameters, false, false);
                }
                MessagingCenter.Send<AddGroupPageViewModel, ChatDto> (this, "ChatCreated", chatDto);
            });
    }
}

I tried debugging through my code. It inters the OnWebsocketProcessMessage method and runs through without any problems. But the subscription doesn't seem to react.

As so often, it works without any problems in iOS and Android.

Any ideas what I'm doing wrong? I'm grateful for every tip... ;)

Problem with scrolling in my iOS App.

$
0
0

Hey guys,
I am facing a problem with scrolling in a ScrollView in my iOS App. My aim is to implement a chatview.
My XAML looks like this:

<Grid VerticalOptions="Fill" x:Name="MainGrid" Padding="5,5,0,15">
        <Grid.RowDefinitions>
          <RowDefinition Height="*" />
          <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*"/>
          <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <local:ChatScrollView x:Name="ChatList" Padding="10" Grid.Row="0" Grid.ColumnSpan="2" VerticalOptions="FillAndExpand" >
          <StackLayout x:Name="ChatMessagesListView"  />
        </local:ChatScrollView>
        <services:EditorGrows Grid.Column="0" Grid.Row="1" AutomationId="EntryMessage" Keyboard="Chat" x:Name="ChatText" Text="" HorizontalOptions="FillAndExpand" Focused="KeyBoardVisible" Unfocused="KeyBoardInVisible"/>
        <Button Grid.Column="1" AutomationId="ButtonMessage" Grid.Row="1" Style="{DynamicResource SecondaryActionButtonStyle}" Text="Senden" VerticalOptions="EndAndExpand"  Clicked="CmdSend"/>
      </Grid>

This is the EditorGrows:

public class EditorGrows : Editor
    {
        public EditorGrows()
        {
            this.TextChanged += (sender, e) => {
                this.InvalidateMeasure();
            };
        }
    }

On Android everything is working perfectly, but on iOS when I press "Return" on the keyboard the Scrollview scrolls to the top and this is what I don't want to happen.

Could it be, that the ScrollView is scrolling because of the call fo the InvalidateMeasure method?

Best regards
Julian

UWP ToolbarItem TextColor

$
0
0

Hi

I have a Xamarin.Forms app targeting iOS, Android and UWP. When I add some toolbaritems (secondary) and start the UWP on my Windows10 machine. The menu appears (when I cklick on the 3-dots-button), but the text is in white color.

This is because my ApplicationBar (with the title) has a blue background color and a white text.

I know, I can't change the color directly on the toolbaritem. But I thought about a renderer...

But how? Can anybody help me out?

My Renderer:

public class UwpBasePageRenderer : PageRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Page> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || Element == null) return;

            Loaded += OnLoaded;
        }

        private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            var mypanel = ContainerElement as Panel;

            // Something like this...
            // mypanel.ApplicationBar.TextColor = Black;

        }
    }

Best WordPress Xamarin sample

$
0
0

I'm new to app programming as well as working with VisualStudio and Xamarin.Forms. I'm looking to create an app that connect with my WordPress blogs. Does anybody know (may be GitHub link) sample of the WordPress app?

After installing the latest Xamarin Studio it did not install Android SDK

$
0
0

After installing the latest Xamarin Studio it did not install Android SDK. I reached out the Xamarin support and I was told to reinstall the SDK manually. I ended up reinstalling Xamarin Studio. But now my Android application won't compile. I feel like I wasted too much time with the latest version of Xamarin.

I have attached am image with the error I am getting now. It is so frustrating.

Viewing all 91519 articles
Browse latest View live