XAM1 - Forms Flashcards

1
Q

What converts a View to platform specific control?

A
  • Renderers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are types of Forms layouts?

A
  • StackLayout
  • GridLayout
  • AbsoluteLayout
  • RelativeLayout
  • also ScrollView
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What can Margin property be added to?

A
  • all Views

- define new Thickness(L, T, R, B)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you execute different values on different platforms?

A
  • Device.OnPlatform

- in code you can also check Device.OS and Device.Idiom (enum = TargetIdiom.Tablet)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are steps to setup an abstraction to platform specific code?

A
  • define interface in PLC
  • provide plat spec implementations
  • use Dependency attribute
  • retrieve dependency in shared code using DependencyService.Get
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the syntax of the dependency attribute?

A
  • [assembly:Dependency(typeof(PhoneDialIOS))]

- this gets registered with dependency service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The Grid.Column and Grid.Row are examples of what?

A
  • attached properties
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are requirements for you to be able to set a property in XAML?

A
  • must be public

- must have a setter

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is x: namespace?

A
  • common across all XAML platforms

- make common XAML keywords available to parser

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you access XAML elements in code?

A
  • add x:Name which adds private fields
  • must be unique and confirm to variable naming conventions
  • not available until after InitializeComponent() runs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Event handlers in XAML?

A
  • can be done, not recommended due to separation of concerns
  • event handlers in XAML can be public, private or protected
  • ex TextChanged=”OnTextChanged”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How can you share values in XAML?

A
  • ResourceDictionary

- accessing via x:StaticResource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is XamlCompilation?

A
  • can be applied at class or namespace level
  • compiles XAML into IL
  • performs compile time checking of XAML
  • lowers file size
  • removes some object instantiation time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How can you re-use XAML views?

A
  • use ContentView
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How are rendered control sizes figured?

A
  • Layouts asks children how much space they request by calling Measure method
  • child View responds with preferred size
  • layout panel calls layout method on child view
  • cycle repeats as needed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

View positioning are controlled by what?

A
  • WidthRequest and HeightRequest

- also VerticalOptions and HorizontalOptions of containers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Vertical/HorizontalOptions default to what?

A
  • FILL
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Is Margin available on all Views?

A
  • YES

- Padding only available on layout views

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What does StackLayout consist of?

A
  • IList called Children

- the order matters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is StackLayout default Orientation?

A
  • Vertical
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

How are attached properties implemented?

A
  • with BindableProperty and BindableObject
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What are grid defaults for Vertical/HorizontalOptions?

A
  • they default to FILL but do respect settings these options on cells
23
Q

What are grid defaults for RowSpacing and ColumnSpacing?

A
  • both default to 6
24
Q

What are the children of a grid?

A
  • IGridList w/ specialized add methods
25
Q

How do you make it so a resource dictionary value can be updated in code and reflected?

A
  • use DynamicResource instead of StaticResource in XAML to access
26
Q

What do shared resources need defined?

A
  • x:Key

- access via StaticResource/DynamicResource and key

27
Q

How do you check for connectivity?

A
  • Connectivity plugin
  • Xam.Plugin.Connectivity
  • CrossConnectivity.Current
  • iOS doesn’t provide roaming info, AND and UWP do
28
Q

What permissions must be added to access connectivity data?

A
  • AND - AccessNetworkState and AccessWifiState

- Win10 - must have Private Networks and Internet (Client and Server) checked

29
Q

REST - what are Safe operations?

A
  • GET, OPTIONS, HEAD - don’t modify data on the server; results can be cached
30
Q

Which REST ops are Idempotent?

A
  • all but POST; same request should end with same result on server
31
Q

What is syntax for using JSON.Net?

A
  • JsonConvert.SerializeObject(obj)

- JsonConvert.DeserializeObject(string)

32
Q

How can you tell an outside service you want json?

A
  • Accept header

- potentially a URL parameter

33
Q

Making Http requests - what should be installed?

A
  • HttpClient
  • install Microsoft.Net.Http into PCL
  • ModernHttpClient also popular option
34
Q

What are HttpClient methods?

A
  • SendAsync - you define VERB and options

- GetAsync, PostAsync, PutAsync, DeleteAsync

35
Q

What is included in HttpRequestMessage?

A
  • Method
  • Address URI
  • Headers
  • Content
36
Q

What is a drawback of using specific Get methods like GetByteArrayAsync, GetStreamAsync, etc

A
  • returns response data immediately but without the response object and therefore no status codes
37
Q

How do you set headers across all requests for a created HttpClient?

A
  • DefaultRequestHeaders.Add
38
Q

What can headers be applied to?

A
  • Request
  • Response
  • and Content
39
Q

What are HttpHandlers?

A
  • live in HttpClient

- do stuff with messages as they flow through pipeline

40
Q

If you customize http pipeline what do you have to add manually?

A
  • HttpClientHandler - this is networking part of pipeline

- you can override HttpClientHandler to use native networking APIs

41
Q

What is ATS?

A
  • App Transport Security for iOS as of iOS 9
  • must use HTTPS with TLS 1.2
  • applies only to native networking stack
  • if you use HttpClient without defining native handler you are outside bounds of ATS
  • you can declare exceptions to ATS in info.plist
42
Q

What are storage options?

A
  • using Settings plugin and storing data in key/value pairs
  • store directly to file system
  • full relational DB like SQLite
43
Q

Can you use System.IO in PCL?

A
  • no, only in platform specific projects using System.IO and types like File, Directory, Stream, etc
44
Q

How do you get special places to store files?

A
  • Environment.GetFolderPath(Environment.SpecialFolder.Personal) for iOS/Android
  • for Win using Windows.Storage.ApplicationData.Current.LocalFolder.Path
  • for iOS app specific stuff should be placed into Library
  • use System.IO.Path.Combine to create Paths
45
Q

What is SQLite built into?

A
  • SQLite is built natively into iOS and Android

- for Win it has to be added via NuGet

46
Q

What is extra step for SQLite and UWP?

A
  • you have to add MS Visual C++ 2013 Runtime
47
Q

When creating what is passed into SQLiteConnection?

A
  • fully qualified path to the database
48
Q

What are best locations for databases on platforms?

A
  • Android/databases
  • iOS/Library
  • UWP LocalState
49
Q

What are SQLiteOpenFlags?

A
  • can be optionally set

- can change things like setting DB as read-only or changing DateTime to NOT save as Ticks

50
Q

What are common SQLite attributes?

A
  • Table(name)
  • Column(name)
  • PrimaryKey
  • Unique
  • AutoIncrement
  • Indexed
  • MaxLength(value)
  • NotNull
  • Ignore
51
Q

What are Linking options for builds?

A
  • Don’t Link
  • Link Framework SDKs only - only “core” mono and “safe” assemblies are pruned
  • Link All
52
Q

Can you make an assembly be included in the Link Framework SDKs only?

A
  • yes, marking with LinkerSafe

- you can also tell Linker to exclude certain assemblies

53
Q

How can you be sure certain code is Preserved?

A
  • can mark assemblies or classes as Preserve
  • ex [Preserve(AllMembers=true)]
  • you can also build a linker configuration XML file with Build Action set to LinkDescription
  • root and definition