Page 46 - MSDN Magazine, September 2018
P. 46
add a StackLayout tag. Substring matching provides a list of possi- ble completions as you type in a control name. For example, if you type Layout, IntelliSense will offer StackLayout, AbsoluteLayout and RelativeLayout as possible completions, as well as closing tags based on the same typing (see Figure 1). This feature is particularly useful when you only remember a control name partially.
Another interesting feature about string matching is CamelCase matching, which provides shortcuts based on CamelCase types. For instance, if you type RL and then press Tab, the editor inserts a RelativeLayout tag. With linting,
before the latest Visual Studio updates. Now you can quickly navi- gate to the definition of an object or resource defined in XAML or C# code, eliminating the chore of manually browsing your code. Peek Definition opens an interactive popup directly in the active editor window, while Go To Definition opens a separate editor window pointing to the desired resource.
Xamarin.iOS Remote Update The XAML editing experience isn’t the only area where Microsoft has worked to increase pro- ductivity. The tooling for Xamarin.iOS has also been enhanced.
the code editor immediately identi- fies some code issues, such as when a property has been specified more than once.
Many readers will know how useful features like light bulbs, quick actions and suggestions are, from their experi- ence with both the C# code editor and the XAML code editor in WPF and UWP. Now these functions are avail- able to Xamarin.Forms. For instance, if a code issue is detected, you can click the light bulb icon (or press Ctrl+.) and Visual Studio will show potential fixes, as you can see in Figure 2, where the code editor detects a missing XML namespace and suggests adding the proper namespace declaration.
Youcanusethelightbulbandquick actions to remove unused namespaces and sort namespaces, which helps keep your code cleaner. IntelliSense also has full support now for binding expressions with markup extensions. For example, if you had a Person- ViewModel class you want to use as the binding context for your UI, and that’s declared as a local resource, IntelliSense will then help you create the binding expression by showing the list of available resources.
With a binding context set up, IntelliSense can help with creating binding expressions, by showing a list of properties exposed by the bound object. Figure 3 provides an example where you can also see a property called FullName, defined in the view model.
Beyond binding are improvements to popular existing features like Peek Definition and Go To Definition, which are now much more reliable in the Xamarin.Forms XAML editor. In fact, both features were problematic
Figure 1 Substring Matching in the XAML Editor for Xamarin.Forms
38 msdn magazine
Xamarin.Forms
Figure 2 The Light Bulb Provides In-Line Quick Actions for Code Issues