In Xamairin the Editor component doesn’t have a border on iOS. If you want to add one in the iOS project just added the following code. using UIKit; using WordBankEasy.iOS.Renderers; using Xamarin.Forms; using Xamarin.Forms.Platform.iOS; [assembly: ExportRenderer(typeof(Editor), typeof(CustomEditorRenderer))] namespace PSC.iOS.Renderers { public class CustomEditorRenderer : EditorRenderer { protected override void OnElementChanged( ElementChangedEventArgs<Editor> e) { base.OnElementChanged(e); if(Control != null) { Control.Layer.BorderColor = UIColor.FromRGB(204, 204, 204).CGColor; Control.Layer.BorderWidth = 0.5f; Control.Layer.CornerRadius = 3f; } } } } Happy coding!
Month: August 2016
Preserve data when deploying Xamarin.Android app
By default all your data from your previous runs is deleted when you’re deploying an Xamarin.Android app. In many cases you don’t want the data to be deleted. Visual Studio To preserve data go to Tools -> Options -> Xamarin -> Android Settings and check “Preserve application data/cache on device between deploys”. Xamarin Studio To preserve data go to Tools -> Options -> Android and check “Preserve data/cache between application deploys”. Happy coding!
“System.IO.FileNotFoundException” using controls from another assembly in Xamarin Forms on iOS.
I was building a Xamarin solution with my components like that: All my components (PSC.Xamarin.Controls.*) are working fine in other solutions.Always fine for Windows or UWP solutions. A problem was born when I started to deployed my solutions on iOS. When on the app I opened a page with my controls I always received an error like: System.IO.FileNotFoundException: Could not load file or assembly ‘PSC.Xamarin.Controls.BindablePicker’ or one of its dependencies. The system cannot find the file specified. I can check my references and deployment settings in all ways, it turns…
Google opens Chromebooks to Android store
Google’s Chromebook update will allow the inexpensive laptops to run apps from the Android store opening them up to apps from Microsoft Word to Quicken.
What is the difference between Xamarin.Form’s layout options?
In Xamarin.Forms every View has the two properties HorizontalOptions and VerticalOptions. Both are of type LayoutOptions and can have one of the following values: LayoutOptions.Start LayoutOptions.Center LayoutOptions.End LayoutOptions.Fill LayoutOptions.StartAndExpand LayoutOptions.CenterAndExpand LayoutOptions.EndAndExpand LayoutOptions.FillAndExpand Apparently it controls the view’s alignment on the parent view. But how exactly is the behavior of each individual option? And what is the difference between Fill and the suffix Expand? Theory The structure LayoutOptions controls two distinct behaviors: Alignment: How is the view aligned within the parent view? Start: For vertical alignment the view is moved to…
Android required permissions
In Visual Studio 2015 if you checked same permissions on your project properties and when reopen it, your checks are disappeared, you have two ways: Is the manifest file marked as ‘read only’ in Windows Explorer? You have to select the Properties directory and un-tick ‘read only’ for the entire folder. Add manually in AndroidManifest.xml file same new rows: <?xml version=”1.0″ encoding=”utf-8″?> <manifest xmlns:android=”https://schemas.android.com/apk/res/android”> <uses-sdk android:minSdkVersion=”15″ /> <application android:label=”$safename$”> <meta-data android:name=”com.google.android.maps.v2.API_KEY” android:value=”yourcode” /> </application> <uses-permission android:name=”android.permission.INTERNET” /> <uses-permission android:name=”com.google.android.providers.gsf.permission.READ_GSERVICES” /> <uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” /> <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” /> <uses-permission android:name=”android.permission.ACCESS_COARSE_LOCATION” /> <uses-permission…
All Windows 10 PCs will get Windows Holographic access next year
Windows 10 users will be able to dive into mixed reality starting next year, with an update planned that can let any “mainstream” Windows 10 PC run the Windows Holographic shell the company first revealed in January 2015. The update will allow users to multi-task in mixed reality environments, which combine traditional 2D Windows 10 apps with immersive, 3D graphical environments. These will be enabled via a range of “6 degrees of freedom devices,” input devices that add positional tracking to other more traditional forms of input, like clicking and…
Custom ContextAction with Xamarin Forms
I using a Xamarin Forms ListView and I want to enable or disable the Context Actions based on a certain binding or in the code behind. The way I found is to use BindingContextChanged in a ViewCell. I show you an example <?xml version=”1.0″ encoding=”utf-8″ ?> <ContentPage xmlns=”https://xamarin.com/schemas/2014/forms” xmlns:x=”https://schemas.microsoft.com/winfx/2009/xaml”> <ContentPage.Content> <StackLayout> <ListView x:Name=”listDictionaries” ItemsSource=”{Binding DictionariesList}” IsVisible=”{Binding ShowList}” HorizontalOptions=”FillAndExpand” VerticalOptions=”FillAndExpand” HasUnevenRows=”true” IsPullToRefreshEnabled=”true” RefreshCommand=”{Binding Refresh}” SeparatorVisibility=”Default” ItemTapped=”OnItemTapped” IsRefreshing=”{Binding IsBusy, Mode=OneWay}”> <ListView.ItemTemplate> <DataTemplate> <ViewCell BindingContextChanged=”OnBindingContextChanged”> <ViewCell.View> <StackLayout> <Grid Padding=”10″ ColumnSpacing=”10″> <Grid.RowDefinitions> <RowDefinition Height=”*” /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width=”Auto” /> <ColumnDefinition Width=”*” /> </Grid.ColumnDefinitions>…
Android.Content.Res.Resources+NotFoundException: Resource ID #0x0
I’ve just created a simple MasterDetailPage and in the code I inserted an icon for the left page with: public MainPage() { InitializeComponent(); BackgroundColor = Color.FromHex("#007acc"); Icon = "settings.png"; } I tried to deploy my app on an Android emulator but I can’t deploy it because Android.Content.Res.Resources+NotFoundException: Resource ID #0x0. I checked everthing and evething seemed fine. The problem is the icon! You have to remove Icon from the code and in the XAML page type the following code: <ContentPage.Icon> <OnPlatform x:TypeArguments=”FileImageSource”> <OnPlatform.iOS>settings.png</OnPlatform.iOS> </OnPlatform> </ContentPage.Icon> Happy coding!
Visual Studio updates Xamarin
When you open Visual Studio 2015 and there is a pop windows to invite you to click on it for updating Xamarin and you click, nothing happends. There is a bug but clicking the update available popup was fixed in one of the recent releases. You can manually update in the Options menu under Tools. As for the errors, I get those all the time. Support packages can often be a problem. Update to the latest XF package. Try deleting bin, obj, and the contents of packages folders and rebuild.