Disclaimer: this is an automatic aggregator which pulls feeds and comments from many blogs of contributors that have contributed to the Mono project. The contents of these blog entries do not necessarily reflect Xamarin's position.

April 21

Podcast: Building Up to Build

In this episode of the Xamarin Podcast, I’m joined by James Montemagno, Principal Program Manager for Mobile Developer Tools at Microsoft, to discuss what is new for Xamarin developers, including new features in the latest Visual Studio for Mac preview, Xamarin.Forms 2.3.4/2.3.5-pre, and updates to Visual Studio Mobile Center. Be sure to download today’s episode from your favorite podcasting app.



Subscribe or Download Today

Keeping up with the latest in .NET, C#, and Xamarin is easier than ever with the Xamarin Podcast! Cohosts Pierce Boggan and James Montemagno cover topics relevant to Xamarin developers, from designing mobile apps to identity management. Be sure to subscribe to the Xamarin Podcast on iTunes, Google Play Music, Stitcher, or your favorite podcast app you use to ensure you don’t miss an episode.

The post Podcast: Building Up to Build appeared first on Xamarin Blog.

The End of IKVM.NET

After almost fifteen years I have decided to quit working on IKVM.NET. The decision has been a long time coming. Those of you that saw yesterday’s Twitter spat, please don’t assume that was the cause. It rather shared an underlying cause. I’ve slowly been losing faith in .NET. Looking back, I guess this process started with the release of .NET 3.5. On the Java side things don’t look much better. The Java 9 module system reminds me too much of the generics erasure debacle.

I hope someone will fork IKVM.NET and continue working on it. Although, I’d appreciate it if they’d pick another name. I’ve gotten so much criticism for the name over the years, that I’d like to hang on to it 😊

I’d like to thank the following people for helping me make this journey or making the journey so much fun: Brian Goetz, Chris Brumme, Chris Laffra, Dawid Weiss, Erik Meijer, Jb Evain, John Rose, Mads Torgersen, Mark Reinhold, Volker Berlin, Wayne Kovsky, The GNU Classpath Community, The Mono Community.

And I want to especially thank my friend Miguel de Icaza for his guidance, support, inspiration and tireless efforts to promote IKVM.

Thank you all and goodbye.

April 20

Requesting Reviews with iOS 10.3’s SKStoreReviewController

Asking your users to review your app is never easy, and there was never an intuitive way to do it. Developers were left to constantly prompt users to review the app with pop ups or by putting a Leave Review button somewhere hidden in the settings, as I have done for many years (here is a quick blog to show you how to do it). Starting on iOS 10.3 this has all changed with the introduction of the SKStoreReviewController, which controls the process of requesting App Store ratings and reviews from your users with a streamlined, in-app dialog. This useful feature is also extremely easy to implement:

if(UIDevice.CurrentDevice.CheckSystemVersion(10, 3))
{
  SKStoreReviewController.RequestReview();
}

Just like that, we get this great looking rating screen:

The MyDriving app using the new StoreKit App Store review APIs.

Important Details

There are some caveats to keep in mind with the SKStoreReviewController, mainly that it isn’t guaranteed to actually show the screen; iOS decide this. On average, it appears the dialog will come up three or four times a year when requesting. As such, you should do some research and only request after your users have used the app for some time. When you’re in development, though, the ability to test the dialog will always be displayed, when your app is in TestFlight it will never be displayed.

Opening the App Store

Finally, this dialog is governed by the App Store policy, which means it should not be called in response to a user action or button tap. This is best reserved for putting in a dedicated Leave Review option somewhere in the app. Apple has updated the mechanism to navigate your users directly to the App Store review page for your app by appending action=write-review to the App Store product URL, as below:

public void OpenStoreReviewPage(string appId)
{
  var url = $"itms-apps://itunes.apple.com/app/id{appId}?action=write-review";
  try
  {
    UIApplication.SharedApplication.OpenUrl(new NSUrl(url));
  }
  catch (Exception ex)
  {
    Debug.WriteLine("Unable to launch app store: " + ex.Message);
  }
}

Learn More

You can read about all of the APIs introduced in iOS 10 and iOS 10.3 on our documentation portal along with a full guide to requesting app reviews with this new mechanism.

The post Requesting Reviews with iOS 10.3’s SKStoreReviewController appeared first on Xamarin Blog.

April 19

2² Decades

Several years ago when we were in 100 robots together, Max was celebrating his 40th birthday. When I said that mine would be in 2017, it felt like an impossibly far future date, but, after what feels like the blink of an eye, here we are.

Along with many other lovely gifts I received this morning was a book with the subtitle Whatever happened to Generation X? by Tiffanie Darke complete with a bright yellow acid house cover and a quote by Douglas Coupland on the cover.

I’ll read the book when I go to Simon and Pinar’s wedding next month, but I’ll share my immediate reaction now. Despite the term being popularised by Coupland’s book, whatever did happen to generation X we won’t read it in a book. We’ll read and write about it on the web we built.

While I remember my parents freaking out when I wanted to wear a bright yellow acid house badge to school, at the time I was more in to loud guitar music like Nirvana and Blur. From the perspective of loud guitars it did feel a bit like I’d missed the party, with Metalica’s Master of Puppets already receading in to the rear view mirror and Led Zeppelin firmly in my parents era, but while we didn’t have The Beatles, I did have computers and networks.

There are plenty of people who would argue that I missed the boat there too: Boolean algebra was developed in 1848; the Halting Problem proved to be undecidable over Turing machines in 1936 and Quicksort was developed in 1959. While the Infer team refused to give up at the halting problem and are now producing amazing real world results using static analysis a lot of computer science was finished before I was born.

My kind of computers weren’t huge machines crunching numbers and doing maths though, they were small pieces loosely joined. Connecting to things and each other they didn’t operate on maths, but changed the world or built new ones. They automated my physics experiment in to different of configurations of springs in a reverb unit so that I could spend more time kissing Ali in the common room, they helped reverse engineer Grand Theft Auto maps and build new ones and automated synthesiser parameters when I didn’t have real controls for them.

They let me record hours of music and made writing books, making films and recording music accessible to everyone and provided a platform for everyone to share what they made. While that made lives harder for those trying to make a living from their art it helped many more lives flourish. The Rolling Stones were forced to become a touring animatronic version of thier former selves when they couldn’t sell CDs, but the french horn player from my school could plunder the past for funk loops to accompany his synthesisers.

The DIY explosion gave us hip-hop and a million flavours of dance music and the networks to share it. Eventually it also gave us digital versions of the Beatles and, now I have been able to download and listen to it all, I’m convinced they have nothing to top the Aphex Twin.

Climate change may mean that our real world horizons are closer and the piles of stuff we collect smaller, but the virtual vistas we can explore are vast and ever growing.

When I watch my children grow up with YouTube it’s amazing to think about what they will accomplish in the future. If they want to do something, they watch it, learn it and do it. Nothing is unknown and nothing is impossible. They’re incredible, which is lucky, as together we’re going to have to save the world.

These thoughts are my own. They don’t represent my employer. They don’t attempt to speak for my generation. I write them and share them because I can and because I want to. Someone might read them and comment on them or link to them to build a web. Thats how my generation works and that’s what we built. We may not have had the Beatles, but I’m OK with that.

Preview: Bringing macOS to Xamarin.Forms

Preview

It’s amazing to think that you can now have a running native macOS application with just a few tweaks to a Xamarin.Forms solution. And I have to say “application” because that’s desktop, right?

As I featured in last week’s Xamarin.Forms 2.3.5 pre-release announcement, macOS support in Xamarin.Forms is now in Preview. Let’s run through adding this new project to an existing Xamarin.Forms solution, the hurdles you may face, and the current and future state of the platform features.

Configuring a macOS Project

Developing for macOS is a Mac only feature, so the same rules apply as when you are doing a Xamarin.Mac application. There is an excellent Xamarin.Mac guide here that covers the prerequisites.

When the time comes for you to integrate your Xamarin.Forms macOS project into a continuous integration system, rest easy that you can build for macOS on Windows just as you can now for iOS.

Add a Cocoa App Project

Until Xamarin.Forms templates adds a Cocoa App, we can easily add it ourselves. To do that in Xamarin.Studio or Visual Studio for Mac, add a new project to the solution and choose Mac > App > Cocoa App.

Adding macOS Project

Configure the Project

The Cocoa App template is configured with a storyboard implementation, which you won’t need. You may leave it there, but you’ll end up with two windows when your application runs.

Here’s the quick list of what you need to do:

  • Add the Xamarin.Forms 2.3.5.233-pre1 pre-release NuGet
  • Reference your Xamarin.Forms project (shared or PCL)
  • Import any assets such as images or fonts
  • Edit info.plist and remove the source entry (NSMainStoryboardFile)
    info.plist
  • Update Main.cs to initialize the AppDelegate

    static class MainClass
    {
    	static void Main(string[] args)
    	{
    		NSApplication.Init();
    		NSApplication.SharedApplication.Delegate = new AppDelegate();
    		NSApplication.Main(args);
    	}
    }

  • Update AppDelegate to initialize Xamarin.Forms, create a window, and load the Forms App
    • If you have other dependencies that need to be initialized, do that here as well.

[Register("AppDelegate")]
public class AppDelegate : FormsApplicationDelegate
{
	NSWindow _window;
	public AppDelegate()
	{
		var style = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled;
		var rect = new CoreGraphics.CGRect(200, 1000, 1024, 768);
		_window = new NSWindow(rect, style, NSBackingStore.Buffered, false);
		_window.Title = "Xamarin.Forms on Mac!";
		_window.TitleVisibility = NSWindowTitleVisibility.Hidden;
	}
	public override NSWindow MainWindow
	{
		get { return _window; }
	}
	public override void DidFinishLaunching(NSNotification notification)
	{
		Forms.Init();
		LoadApplication(new App());
		base.DidFinishLaunching(notification);
	}
}

Run it!

With the macOS project as the startup, run it. Voila! You now have a native macOS application!

Example of Sample Weather App

What’s Next?

Now that you have an app, it’s time to put on your UX Designer hat and start exploring the changes you need to feel more at home in this new desktop environment.

Styling

Take a run at styling your Xamarin.Forms UI for macOS. The same styling used on mobile may not look right. This is easily updated!

With recent changes made to OnPlatform you can now target any number of platforms. That includes macOS.

<Button.TextColor>
	<OnPlatform x:TypeArguments="Color">
		<On Platform="iOS" Value="White"/>
		<On Platform="macOS" Value="White"/>
		<On Platform="Android" Value="Black"/>
	</OnPlatform>
</Button.TextColor>

Note you may also double up on platforms like <On Platform="iOS, macOS" ...>.

Window Size and Position

Is the launch window too big? Too small? Launching in an odd position on screen? You can adjust all of this in the AppDelegate on this line:

var rect = new CoreGraphics.CGRect(200, 1000, 1024, 768);

Known Issues

This is a Preview, so you should expect that not everything is production ready. Below are a few things you may encounter as you add macOS to your projects.

Not All NuGets are Ready for macOS

In order to work in a macOS project, packages must target xamarinmac20. You may find that some of your beloved libraries do not yet support macOS. What can you do? Kindly send a request to the project’s maintainer to add it. Until they have support, you may need to look for alternatives.

Xamarin.Forms Features

This preview has amazing coverage of Xamarin.Forms UI and features, but there are some known gaps to be aware of.

Not Yet Implemented:

  • OpenGlRenderer
  • ListView – ScrollTo, UnevenRows support, refreshing, SeparatorColor, SeparatorVisibility, Footer
  • ViewCell – IsEnabled, ForceUpdateSize
  • Image – Aspect
  • Picker – Bindable / Observable implementation
  • MasterDetailPage – BackgroundColor
  • TabbedPage – BarBackgroundColor, BarTextColor
  • TableView – UnevenRows
  • WebView – Most WebNavigationEvents
  • Navigation – InsertPageBefore

Send Your Feedback!

Add a macOS project and the Xamarin.Forms 2.3.5.233-pre1 pre-release to your solutions today and let us know what you think. What do you feel is missing? What problems do you encounter?

For a quick start, you can grab the WeatherApp I updated on GitHub: https://github.com/xamarin/xamarin-forms-samples/tree/forms-macos-preview/Weather

Join the macOS discussion in the Xamarin forums.

The post Preview: Bringing macOS to Xamarin.Forms appeared first on Xamarin Blog.

April 18

Guest Post: Adding a Calendar to Your Xamarin.Forms Apps with the Telerik Calendar

This is a special guest post from the Progress team at Telerik, the makers of the Telerik UI suites. Speaking on behalf of these awesome engineers of developer tooling is Sam Basu, a Developer Advocate for Telerik products and Xamarin aficionado. You may find him on Twitter as @samidip.

Celendar in action gif

Are you already building cross-platform native mobile apps using Xamarin.Forms? If so, great job picking your technology stack! After all, where else could you reuse your skills in C#/XAML to make apps that run on every platform with a truly unified single codebase? While Xamarin provides a vast array of frameworks, IDEs, and integrations, apps may sill need controls outside of those included in Xamarin.Forms. Rather than building your own custom control, developers may prefer to grab a well-engineered, performant UI control out-of-the-box from a service such as Telerik to help ship apps faster. Think of a polished UI as your must-have “wow” factor; that’s what you’ll get with Telerik UI for Xamarin.

Calendars keep our lives organized and productive; everyone uses them and increasingly so in digitally, so it’s no surprise that your mobile app may need to display a calendar and manage events. Turns out, however, calendar UI is tricky business, and the little details make all the difference.

The Telerik Calendar in UI for Xamarin is designed so you can offer your users the ultimate in productivity in your apps with various calendar scenarios. Yes, these are truly native calendars on every mobile platform, simply rendered through the Xamarin.Forms abstraction. The Telerik Calendar not only capitalizes on all of the innate benefits provided by native UI, it also exposes properties/events in C# to allow developers full customization and flexibility. This post introduces Telerik UI for Xamarin and then dives head first into leveraging the Telerik Calendar to explore all of the available customization options for developers.

Telerik UI for Xamarin

Telerik UI for Xamarin is a collection of Xamarin.Forms controls and Xamarin bindings built on top of the native Telerik UI for iOS and UI for Android suites. The Xamarin.Forms controls also utilize controls and features from the Telerik UI for UWP, providing a common API that allows the developer to use the native Telerik components on all three mobile platforms (iOS / Android / Windows) using a single shared code base. UI for Xamarin provides rich and performant UI controls out-of-the-box, so that you can focus on delivering app features using functional UI components.

We know developers don’t always trust high-octane words, though, right? You can play around with the Telerik UI for Xamarin suite yourself and see if it fits your needs. You’re able to check out the performance and interactivity of each of the controls before deciding if it’s right for your Xamarin app. There are beautiful showcase apps that highlight UI for Xamarin controls for each mobile platform, along with the sample code to achieve the same results. Find the apps in respective app stores, including the iOS App Store and Google Play.

Getting Started

So, how do you incorporate Telerik UI for Xamarin in your Xamarin project? A simple trial download may be the easiest way to get started. Simply head to the download site and pull down the bits. Once downloaded, you’ll find examples, templates, and binaries specific to each platform as swell as shared ones.

If you have the luxury of starting work on greenfield projects, Telerik UI for Xamarin offers several handy project templates/wizards. The goal is to give developers a great starting point with their Xamarin projects, both on Visual Studio and Xamarin Studio.

Be it on Windows or Mac, one of the easiest way for developers to integrate UI for Xamarin in their Xamarin projects is the Telerik NuGet Server. The first step is to configure your IDE’s Package Manager to point to the Telerik NuGet feed. This is in your Preferences/Options and works the same way in Visual Studio and Xamarin Studio. Simply set up a new NuGet source to point to the Telerik gallery at https://nuget.telerik.com/nuget, authenticate yourself for the first time, and done!

Adding the Telerik NuGet source in Visual Studio.

Here’s how you use NuGet to pull in UI for Xamarin bits into an existing project, shown here for Xamarin Studio for brevity, though Visual Studio has the same workflow. Once you pull in the Telerik UI for Xamarin package, NuGet does the rest of the magic; you’ll have the required UI for Xamarin references in your shared PCL as well as all the platform specific projects. One big advantage of the NuGet route is that not only do you get an easy way to pull in UI for Xamarin references into your existing project, you also get easy updates too.

Add the Telerik NuGet package.

Several of the UI for Xamarin controls gain their polish, behavior, and performance from the fact that they are truly native UI controls customizable for each platform. Accordingly, to render them from a Xamarin.Forms abstraction requires custom renderers. No worries, though, everything comes ready out-of-the-box, you just need to register the renderers in your app. The docs will show you how to register the renderers for each control when using them on iOS, Android, and UWP platforms. Here’s a sample of what you need when using the Telerik Calendar control in iOS apps. The following code goes in the AppDelegate.cs file in your iOS-specific project:

using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using Xamarin.Forms;
[assembly: ExportRenderer(typeof(Telerik.XamarinForms.Input.RadCalendar), typeof(Telerik.XamarinForms.InputRenderer.iOS.CalendarRenderer))]
namespace MyApp.iOS
{
    [Register("AppDelegate")]
    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
    {
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            Telerik.XamarinForms.Common.iOS.TelerikForms.Init();
            LoadApplication(new App());
            return base.FinishedLaunching(app, options);
        }
    }
}

Once you have all of the bits referenced and renderers registered, you’re ready to roll with the Telerik Calendar control. Fire up any XAML view and this simple markup renders the Calendar for you:

... xmlns:TelerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input" ...

Calendar Visual Structure

The Telerik Calendar control is a calendar for sure, just rendered with painstaking accuracy for your app with a many customization options and catered to the unique UI paradigms of each mobile platform. Before we start tweaking things, it helps to see the overall, big-picture control—the simple rendering of the Telerik Calendar with all visual elements explained. The labels should be self-explanatory:

Telerik Calendar control UI.

You also get some control to show or hide specific details to suit your needs. By default, the day names show up and the week numbers don’t, but here’s some code to flip both (along with the resulting calendar on each mobile platform):

var calendar = new RadCalendar();
calendar.WeekNumbersDisplayMode = DisplayMode.Show;
calendar.DayNamesDisplayMode = DisplayMode.Hide;

Telerik Camera control visual structure.

Calendar ViewMode

The Telerik Calendar has several supported *View Modes* that control how the calendar is initially rendered, namely:

  • Month
  • Week
  • Year
  • MonthNames
  • YearNumbers
  • Flow

Not every view mode is supported on all mobile platforms, with only iOS having the distinction of supporting them all. There are some methods exposed for changing up view modes programmatically, aside from via user action. Each of these return true if there is support or if navigation is possible, otherwise they return false:

  • TrySetViewMode: Sets the Calendar to a specific view mode
  • TryNavigateToUpperView: Navigates calendar to upper view if possible
  • TryNavigateToLowerView: Navigates calendar to lower view if possible

The hierarchy of navigation among view levels is mobile platform-dependent, like so:

  • iOS: YearNumbers > Year > MonthNames > Month > Week
  • Android: Year > Month > Week

Here’s some simple code to instantiate a calendar and set the view mode to year, all programmatically:

var calendar = new RadCalendar();
calendar.NativeControlLoaded += CalendarLoaded;
private void CalendarLoaded(object sender, EventArgs args)
{
    (sender as RadCalendar).TrySetViewMode(CalendarViewMode.Year);
}

Calendar Date Management

The Telerik Calendar exposes some properties that allow the developer programmatic flexibility to manipulate the calendar user experience:

  • DisplayDate: A date in the current view
  • MinDate: Gets/Sets the minimum date that could be displayed or selected
  • MaxDate: Gets/Sets the maximum date that could be displayed or selected

Each of the date properties can be set explicitly or relative to the current date, like so:

// XAML Markup
xmlns:TelerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"

// Code Behind
MyCalendar.MinDate = DateTime.Today.AddMonths(-1);
MyCalendar.MaxDate = DateTime.Today.AddMonths(5);
MyCalendar.DisplayDate = DateTime.Today.AddMonths(2);

What do users want to do most from a Calendar? The ability to select dates, of course. The Telerik Calendar sports a simple date selection functionality, both through user interaction and programmatically. Date selections should be available as single, multiple, or a range of dates. Two key things make this possible:

  • SelectedDate: Gets/Sets currently selected date
  • SelectionChanged: Event raised when the selected date is changed

Here’s some code that sets up the calendar to display the default month view mode and selects a date programmatically:

RadCalendar calendar = new RadCalendar();
calendar.SelectedDate = new DateTime(2016, 12, 14);

Below is the result; notice the style differences in the calendar controls rendered across different mobile platforms.

Telerik Camera control date selection.

Calendar Appointments

Any calendar UI needs to display appointments, it’s how you keep users engaged and productive. Appointment support in the Telerik Calendar begins with the Telerik.XamarinForms.IAppointment interface, which sports three basic members: StartDate, EndDate, and Title, but you should definitely consider adding more descriptors to your appointments as needed. A sample Appointment class implementing the interface is below:

public class Appointment : IAppointment
{
    public DateTime StartDate { get; set; }
    public DateTime EndDate {  get; set; }
    public string Title { get; set; }
    public bool IsAllDay { get; set; }
    public Color Color { get; set; }
}

A collection of appointments, all stemming from an IAppointment interface implementation, can be fed to the Telerik Calendar control directly by simply using the AppointmentSource property, which can also be data bound. Here are some sample appointments being bound to the Calendar and the corresponding results in each platform:

calendar.AppointmentsSource = new List() {
    new Appointment() {
        StartDate = DateTime.Today.AddDays(1),
        EndDate = DateTime.Today.AddDays(2).AddTicks(-1),
        Title = "Mom's Birthday",
        Color = Color.Red },
    new Appointment() {
        StartDate = DateTime.Today.AddDays(3).AddHours(17),
        EndDate = DateTime.Today.AddDays(3).AddHours(22),
        Title = "Big Game",
        Color = Color.Green },
    new Appointment() {
        StartDate = DateTime.Today.AddDays(11).AddHours(20),
        EndDate = DateTime.Today.AddDays(12).AddHours(4),
        Title = "Progress Party",
        Color = Color.Red }
};

Here’s a quick look at how professional Telerik Calendar appointments can look like through the Telerik UI for Xamarin Examples app (find the app on the iOS App Store and Google Play):

Calendar in action gif

Custom Calendar Cell Styling

Sure the Telerik Calendar has a polished UI, but there are times where you may want to customize its look and feel by manipulating the tiniest details and, in true developer-friendly form, the Telerik Calendar allows you to have custom styles for each cell.

You can set a property called SetStyleForCell to a custom function that can style individual Calendar cells. All cells share a common base class, the CalendarCell, with the following properties:

  • Text: Gets the text displayed in the cell.
  • Type (CalendarCellType): Gets the type of the cell. The possible values are:
    1. Date: All cells that correspond to actual dates have this type
    2. WeekNumber: Cells that hold week numbers
    3. DayName: Cells that hold the days of the week

Each cell can be styled using the CalendarCellStyle class, which has the following options:

  • BackgroundColor
  • BorderColor
  • BorderThickness
  • FontSize
  • FontWeight
  • ForegroundColor

Armed with cell styling flexibility, here’s how to color the first day of spring to be a green cell in the Calendar, for example:

var calendar = new RadCalendar();
calendar.SetStyleForCell = this.EvaluateCellStyle;
private CalendarCellStyle EvaluateCellStyle(CalendarCell cell)
{
    var springStyle = new CalendarCellStyle {
        BackgroundColor = Color.Green,
        FontSize = Device.OnPlatform(14, 30, 17),
        FontWeight = FontWeight.Normal,
        ForegroundColor = Color.FromRgb(139, 209, 0)
    };
    var dayCell = cell as CalendarDayCell;
    if (dayCell != null && dayCell.Date.Day == 22 && dayCell.Date.Month == 3)
    {
        return springStyle;
    }
    return null;
}

And the result:

Another common customization opportunity may arise with Appointments, where you may have a need to custom-style appointments on a busy calendar. With the Telerik Calendar, you get an AppointmentStyle property which is of the CalendarAppointmentsStyle type. This allows for complete color-coded customization of appointments with text and shapes.

Here’s the visual structure of appointment styling in calendar cells; you can use text or shape or both.


Some of the styling opportunities with CalendarAppointmentsStyle come with the following properties:

  • DisplayMode: Defines how appointments are visualized. Values can be Text, TextWithShape, TextWithBackground, and Shape.
  • Padding: Defines the padding of the rectangle that holds the events.
  • Spacing: Defines the empty space between two appointments in the same date.
  • ShapeType: Defines the shape representing an appointment. Values can be Rectangle, Ellipse, TriangleUp, TriangleDown, and Rhombus.
  • AllDayIndicatorLocation: Defines the location where the all day indicators are visualized.

Some examples of shapes representing appointments can be visualized as below:

An example of an all-day appointment indicator is below. You get to control the location, width, and padding of how the indicator is rendered in the calendar cell:

Conclusion

With Xamarin.Forms democratizing cross-platform mobile development for .NET developers, you can be proud to choose the Xamarin technology stack… just don’t go reinventing the wheel with complex manually-built UI. Telerik UI for Xamarin is here to help, and the engineering efforts behind each control show in their performance and polish. When you need to support any type of calendars and events in your cross-platform mobile app, the Telerik Calendar stands ready out-of-the-box, with a myriad of customization options. Just look through the detailed docs when you’re ready and keep your app users productive with the right calendar support. Cheers and happy coding!

The post Guest Post: Adding a Calendar to Your Xamarin.Forms Apps with the Telerik Calendar appeared first on Xamarin Blog.

Trunk-based development blends well with task branches

This is the third installment in the series of blogposts telling how we develop Plastic SCM. In the first two posts, we covered what our new working cycle looks like once we moved to trunk based development and then we gave a brief overview of the meaning of release versus deploy.

In this third blog post, we will be looking back and filling in some gaps. What exactly is trunk-based development and how does it blend with task branches?

April 14

Go from Sketch to Rapid Prototype and Manufacturing with Blank Slate’s Xamarin-Based Zotebook

Our mission has always been to make it fast, easy, and fun to build great mobile apps and to help any developer deliver apps on any platform and any device. Blank Slate Systems has a similar philosophy: allow people of all ages and across all sectors to turn creative ideas into reality. Their first app, Zotebook (currently available for iOS), is an easy alternative to CAD, turning rough sketches into precision drawings ready for 3D printers and laser cutters.

Today, Kyle Kuczun, Blank Slate’s CEO, tells us how Zotebook brings sketch recognition technology and 3D printing to the masses, from high school STEM workshops to professional architects and designers, and why .NET is the only option to get the precision and quality their users demand.

Tell us a little bit about your company and role.

We aim to make it easy for anyone, from sellers on Etsy and Kickstarter to engineers at large industrial and manufacturing companies, to go from concept to product, from idea to manufactured creation. 3D printers turn designs into physical objects, but complicated design software and a fragmented tool chain makes the “making things” process more challenging than it has to be.

Together with my CTO and co-founder, Gabe Johnson, who has been programming software for 25+ years, Blank Slate offers a solution to this problem by turning anyone into a creator. Gabe and Dr. Mark Gross founded the company in 2012, and I joined in 2016. Our software, born out of Gabe’s PhD work with Gross at Carnegie Mellon, uses innovative algorithms and interaction techniques to make it simple and straightforward for anyone to use a tablet to create and edit a design that can be fabricated with laser cutters or rapid manufacturing devices.

Describe Zotebook for us, and what it allows your customers to accomplish.

Designers typically capture ideas with paper and pencil and only move on to pixels when they’re ready to commit, because traditional CAD programs require immediate specification like line thickness, line length, and alignment. At Blank Slate, we use computational media to re-think how people design, and our platform provides an easy way to turn sketches into physical objects. Zotebook, our Xamarin-based mobile app, uses sketch recognition technology to capture and clean up rough drawings; users sketch an idea with their fingers, and we turn it into a precision drawing (known as a CAD file). The next problem is preparing the file for specific output devices, like a laser cutter or 3D printer, which is where our cloud service does its magic by simplifying the workflow pipeline, from initial concept to physical object, whether it’s manufactured with a 3D printer, laser cutter, or CNC (Computer Numerically Controlled) router.

Zotebook on iPad

For example, say you want to laser cut several designs in one run; you’d need to assemble shapes from separate files into one file and pack shapes together to optimize the material you’re cutting, reducing waste and saving money. Zotebook works with Blank Slate’s cloud app to automatically tightly pack (or “nest”) your shapes together in your cutfile, so you don’t waste material. You can even re-use material with holes by indicating areas to avoid when laying out sketches.

We also integrate with top CAD companies, like SketchUp and Onshape, and we partner with on-demand manufacturers like Voodoo Manufacturing and Ponoko. Our customers can automatically save their designs to our cloud app, import them to other design software, and import/export them to other 3rd party sites.

Why did you choose Xamarin?

After building our proof of concept targeting laptop computers in Java, we knew we needed to move to the tablet to allow users to interact with their designs and use their fingers to “sketch.”

We considered writing our apps with platform-specific code (e.g. Objective-C or Swift for iOS and Java for Android) or as a “web-app-to-native” product. But, the former is too heavy an investment in any one platform, and the latter lacks the ability to tap into native graphics.

We’re making a design tool, so our technology must provide superior graphics and better UX. Access to hardware-accelerated graphics is essential, and native is the only way to achieve that. Xamarin gives us access to native OpenGL graphics for all the platforms we support. For engineering reasons, C# and .NET are a good platform for building apps that evolve over time; there’s a huge developer community, great documentation, and an evolving 3rd party library ecosystem. The toolchain is also excellent, from the IDE for development to the package management and regression testing.

Xamarin makes it easy for us to develop apps for all platforms, which is critical for reaching our customers. After four years, we’re delighted with Xamarin.

How did you get up to speed with cross-platform mobile development?

When we first jumped into this, both platform providers and developers were still figuring out how mobile worked.

For us, trial-and-error and lots of reading blogs and forums for advice resulted in success. Additionally, the community, both inside and outside of Xamarin/Microsoft, has been a great learning resource.

Walk us through your development process. Has it evolved over time?

At a high-level, it’s pretty straightforward: we use Xamarin Studio on Mac (Visual Studio for Mac Preview), conduct unit testing, and then manually build and deploy.

Our first iOS release (in 2014) took a fair amount of time. It was the first commercially available sketch recognition application. Although we had to build the machine learning and UX components ourselves, it would have taken twice as long with Objective-C, the only other (viable) option when we started.

The .NET software ecosystem and community has been important to our success, and we’ve incorporated open source tools to go faster with fewer bugs. As of today, we’ve deployed our sketch tool on iOS, and the response has been amazing.

Tell us more about how your users are responding. What’s your favorite review?

The overall response has been great! Because of our tool’s broad applicability and ease of use, we appeal to a wide range of people with varying degrees of design expertise. We allow designers, engineers, and architects (or whoever else!) to create their ideas, faster. The result is an increase in iteration speed, resulting in better designs and products.

We’ve had four–year old kids sketch an idea and, within minutes, successfully laser-cut a physical object. Most four-year olds can’t tie their shoes, and our technology lets them build—imagine what a trained designer can do!

One review on the Apple AppStore says, “Crazy simple, but it works!” This is my favorite, because it illustrates our goal. We want anyone to be able to make their ideas; we want to take you from thought to thing. To do this, our tools have to be crazy simple.

To date, we have 36K+ downloads, including STEM educational organizations, maker labs, and an array of professional designers and engineers.

What’s your team planning to build next?

Sketching is the beginning of design. Just as Xamarin supports the programmer and integrates with the full C# and .NET ecosystem, Blank Slate’s sketch application supports the designer or engineer and integrates with the full lifecycle of thought to thing.

We are simplifying the entire workflow, which includes integrating with various software and hardware tools that complement and augment our solution. For example, our in-development SketchUp integration lets SketchUp users import their sketches and apply advanced 3D editing. We’re about to ship another feature that allows architects and engineers to explode 3D models into 2D flatpack parts (from OnShape and SketchUp), and further optimize their files to work on their desktop manufacturing devices, creating physical models out of paper, plastic, or wood.

Lastly, working in the 3D world is important, even if you’re starting from a 2D design. We have an upcoming release to enable users to extrude designs into 3D.

After we deliver this next round of features, we’ll port our app to other platforms. 90% of our codebase is already cross-platform.

What advice do you have for developers who are just starting out or investigating mobile development?

One of the important things that experts have is intuition. To develop and hone intuition, you need to understand underlying organizing principles. Software development is more than a bunch of lines of code; there are organizing principles to good programs: how to design, write, maintain, collaborate, and debug. The sooner you understand the patterns that underlie mobile development, the faster you’ll start having success.
 
 
Visit xamarin.com/customers to learn how our customers across industries and geographies deliver amazing mobile apps and xamarin.com/download to start building your own.

The post Go from Sketch to Rapid Prototype and Manufacturing with Blank Slate’s Xamarin-Based Zotebook appeared first on Xamarin Blog.

April 13

Make Your Xamarin.Forms Apps Even Better (and Faster!)

As we continue to pursue the best in stability and performance, we’re excited to get your feedback on our first pre-release of Xamarin.Forms 2.3.5. Boasting over 130 fixes and enhancements this release, I’d like to highlight a few that we’re most eager for you to explore: Fast Renderers, ListView enhancements, and macOS preview!

Fast Renderers for Android

The concept behind Fast Renderers is fairly simple: reduce inflation and rendering costs by flattening the control nesting. Simple almost always performs better! We’re delivering Button, Image, and Label in this first batch of optimized renderers. To use it, do nothing; they’re on by default in this pre-release.

Our initial testing teases upwards of 2x speed improvement to render a view with these controls. Large ListView scrolling with cells of these controls was visibly smoother and recovered much faster when aggressively scrolling thousands of rows. What’s clear, and is no real surprise, is that hardware, OS version, and the complexity of the view are significant factors in how greatly this will impact your results.

Join our performance discussion in the forums and let us know your results. We’re also asking for XAML layout contributions to build up our performance test suite. We’d love your participation!

We have more work to do performing this refactoring on the remaining controls for Android and iOS, but we’re excited to share what we have so far.

ListView Enhancements

We continue to chip away at improving list performance. Fast Scroll on Android is now enabled by default and may be set using a Platform Specific.

listView.On<Android>().SetIsFastScrollEnabled(true);

If you’re using a shared project like I am and have a namespace collision with Android, this is a clean way to address that:

using Platform = Xamarin.Forms.PlatformConfiguration;
...
listView.On<Platform::Android>().SetIsFastScrollEnabled(true);

And with FastScrollEnabled you can now use Section Indexes.

Android isn’t the only beneficiary of ListView love. iOS and UWP get over a dozen updates and fixes to address performance, recycling, and reported memory leaks.

macOS Preview

We know many have been following our macOS backend for Xamarin.Forms progress and building from that public branch. Today, we hope everyone will give this preview a run and provide your feedback. Here are the basics of what you need to get started:

  1. Add a Mac Cocoa App project to your Xamarin.Forms solution and set it as your Startup Project
  2. Add a project reference to your shared project or PCL
  3. Import any platform specific resources such as images or fonts
  4. Add this pre-release NuGet to all projects and PCLs
  5. Update the AppDelegate.cs
  6. Run it!

Here’s a template AppDelegate.cs to give you a jump start:

[Register("AppDelegate")]
public class AppDelegate : FormsApplicationDelegate
{
	NSWindow _window;
	public AppDelegate()
	{
		var style = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Titled;
		var rect = new CoreGraphics.CGRect(200, 1000, 1024, 768);
		_window = new NSWindow(rect, style, NSBackingStore.Buffered, false);
		_window.Title = "Xamarin.Forms Mac";
		_window.TitleVisibility = NSWindowTitleVisibility.Hidden;
	}
	public override NSWindow MainWindow
	{
		get { return _window; }
	}
	public override void DidFinishLaunching(NSNotification notification)
	{
		Forms.Init();
		LoadApplication(new App());
		base.DidFinishLaunching(notification);
	}
}

Try It Today!

To get Xamarin.Forms 2.3.5.233-pre1, search your NuGet package manager with the pre-release option enabled, and install it into each PCL and App project.

Be sure to check the full release notes, and to see what else is in the Xamarin.Forms pipeline visit the public roadmap.

If you have a bug to report, drop us a detailed report here so we can investigate.

Discuss this post on the Xamarin Forums

The post Make Your Xamarin.Forms Apps Even Better (and Faster!) appeared first on Xamarin Blog.

April 12

Displaying Data with macOS Table Views

In addition to beautiful, cross-platform native mobile apps, Xamarin also enables you to create macOS apps with Xamarin.Mac. To get started, be sure to read our introductory post to macOS development in C# where we begin to build a Pomodoro task-tracking application. Our application consists of a countdown timer that assists with managing one’s workload into 25 minute blocks.

Displaying a list of data is a common pattern for any type of application development, from mobile to desktop. Table views are great for displaying structured data and are backed with powerful APIs, which allow the table view to be manipulated. Across all mobile development platforms, the basic concept is the same; a list view contains cells, which are populated by a code behind class that populates the list and tells it how to behave. If you’re already familiar with iOS development, the macOS approach will feel even more similar. In this post, we’ll be building on our Pomodoro macOS app by adding an activity log to track accomplishments by displaying them in a table view.

Mar-29-2017 14-34-54

Adding a Table View to the UI

To follow along, download the starter code for this blog post, which contains the basic Pomodoro macOS app we’ll be extending. The first thing we’ll do is update our user interface to add the table view. In Xamarin Studio, double-click the storyboard file to open in Xcode.

Move the timer label and start button to the top of the window to make room for the table view. Next, open the Object Library on the right side, and scroll down to find the Table View. Drag it onto the window and adjust as necessary to fit. To change the table headers for each column, double-click the header text and enter a new title, such as “Time Completed” and “Task”.

We can make this list easier on the eyes by alternating the background color for each list item. To do so, select the Table View from the View Controller Scene and check the Alternating Rows option from the Attributes Inspector, as shown here:

Screen Shot 2017-03-31 at 17.34.14

Populating the Table View

Now that we’ve added the table view itself, we need to populate it with tasks. If you’ve added a table view to an iOS (or Android) project before, this will look familiar to you.

The first thing we need to do is create a new class, which will store the information we want to hold for each row in the table view. Create a new empty class named Activity.cs (right-click the macOS project -> New File… -> General -> Empty Class) and add the following code:

using System;

namespace Pomodoro

{

    public class Activity
    {
        public DateTime TimeCompleted { get; set; }
        public string TaskDescription { get; set; }
        public Activity() { }

        public Activity(DateTime timeCompleted, string taskDescription)

        {
            this.TimeCompleted = timeCompleted;
            this.TaskDescription = taskDescription;
        }
    }
}


To manage the data in the table view we need to use a NSTableViewDataSource which holds a list of Activity. Also, override GetRowCount to return the number of records in the list. Add another new empty class named ActivityLogDataSource.cs, and add the following code.

using System;

using System.Collections.Generic;

using AppKit;

namespace Pomodoro

{
    public class ActivityLogDataSource : NSTableViewDataSource

    {
        public ActivityLogDataSource()
 { }
        public List Activities = new List();
        public override nint GetRowCount(NSTableView tableView)
        {
            return Activities.Count;
        }
    }
}

We need a delegate in addition to the data source, which will return the view for a given column and row. The view will be populated with data from the data source we created above. Add a new empty class named ActivityLogDelegate.cs.

using System;

using System.Collections.Generic;

using AppKit;

namespace Pomodoro

{
    public class ActivityLogDelegate : NSTableViewDelegate

    {
        private const string CellIdentifier = "ActivityCell";
        private ActivityLogDataSource DataSource;
        public ActivityLogDelegate(ActivityLogDataSource datasource)
        {
            this.DataSource = datasource;
        }
        public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, nint row)
        {
            // This pattern allows you reuse existing views when they are no-longer in use.
            // If the returned view is null, you instance up a new view.
            // If a non-null view is returned, you modify it enough to reflect the new data.
            NSTextField view = (NSTextField)tableView.MakeView(CellIdentifier, this);
            if (view == null)
            {
                view = new NSTextField();
                view.Identifier = CellIdentifier;
                view.BackgroundColor = NSColor.Clear;
                view.Bordered = false;
                view.Selectable = false;
                view.Editable = false;
            }
            // Set up view based on the column and row
            switch (tableColumn.Title)
            {
                case "Time Completed":

                    view.StringValue = DataSource.Activities[(int)row].TimeCompleted.ToString("H:mm");

                    break;
                case "Task":
                    view.StringValue = DataSource.Activities[(int)row].TaskDescription;
                    break;
            }
            return view;
        }
    }
}


Connecting Everything

To be able to reference the table view from the view controller, we’ll need to create an outlet. Open the Assistant Editor view in Xcode and control-drag from the “Table View” in the document outline (not directly from the storyboard) onto the ViewController.h code. Name this “ActivityLog”. If you’re unsure how to do this, check out the previous blog post where we touched on creating outlets and actions from the storyboard in Xcode.

Mar-31-2017 19-46-21

Back in Xamarin Studio, open ViewController.cs and add the following property:

ActivityLogDataSource log = new ActivityLogDataSource();

Then, in the ViewDidLoad method, we need to set the delegate and datasource for the table view:

ActivityLog.DataSource = log;
ActivityLog.Delegate = new ActivityLogDelegate(log);

Finally, we want to provide the user with a way to input their task once the timer has finished. The easiest way to do this would be to add a text field to the alert sheet. We need to handle the text from this input and add it to the activity log along with the current time. Directly after the code for setting up the alert, add the following snippet:

using CoreGraphics;
...
// The text field we are going to add to the sheet
var input = new NSTextField(new CGRect(0, 0, 300, 20));
// Add the text field to the sheet
alert.AccessoryView = input;
// Get the current time
.
DateTime CurrentTime = DateTime.Now;
// Display the NSAlert from the current view

alert.BeginSheetForResponse(View.Window, (result) =>

{
    // When the sheet is dismissed add the activity to the log
    log.Activities.Add(new Activity(CurrentTime, input.StringValue));
	ActivityLog.ReloadData();

});

We’re finished! In just a few lines of code we added a macOS NSTableView that allows us to keep a record of our tasks completed in Pomodoro cycles.

Mar-29-2017 14-34-54

Wrapping Up

Table views in macOS are just as powerful as table views in iOS and equally simple to use in your apps. If you want to learn more about table views in Xamarin.Mac then check out our documentation. The starting point and completed project can be found at https://github.com/BytesGuy/XMPomodoro/

The post Displaying Data with macOS Table Views appeared first on Xamarin Blog.

April 11

Live Webinar | Getting the Most Out of Xamarin.Forms for Visual Studio 2017

Xamarin.Forms gets better, faster, and more performant with each release, making it easier for developers to build amazing Android, iOS, and UWP apps from a single codebase. You can learn about all of the exciting updates in our latest release in my upcoming demo-packed webinar, Getting the Most Out of Xamarin.Forms for Visual Studio 2017, on Tuesday, April 25.

We’ll go from standard UI to taking complete control of designs and interactions, plus adding transitions and applying finely tuned layout systems to make screens render faster than ever. You’ll leave the session ready to optimize your Xamarin.Forms interfaces for better performance and user experience.
 

Register


During this webinar, you will:

  • Build fully native Android, iOS, and UWP apps with XAML
  • Create customized UI with Routing Effects and Platform-Specifics
  • Use bindable, native picker controls to address common UI scenarios
  • Apply XAMLC to get notified of issues at compile-time and boost performance
  • Deliver better UX with deep-linked URLs, custom animations, and more
  • Learn best practices to improve Android performance and use the newest libraries

Sign up now to join us on Tuesday, April 25 at 9 am PT / 12 pm ET / 4 PM GMT.
 
We encourage all registrants to attend the webinar live, as we will be answering questions throughout the event, however, all registrants will receive a link to the recording, so please feel free to sign up even if you cannot join us that day.

The post Live Webinar | Getting the Most Out of Xamarin.Forms for Visual Studio 2017 appeared first on Xamarin Blog.

Monologue

Monologue is a window into the world, work, and lives of the community members and developers that make up the Mono Project, which is a free cross-platform development environment used primarily on Linux.

If you would rather follow Monologue using a newsreader, we provide the following feed:

RSS 2.0 Feed

Monologue is powered by Mono and the Monologue software.

Bloggers