Chapter 15 Notes
Title: The Interactive Interface
Summary
So much ado about Labels and the text in them.
Programming Concepts Summary
Eight Views for this chapter.
Data Type |
Views |
Double |
Slider, Stepper |
Boolean |
Switch |
String |
Entry, Editor, SearchBar |
DateTime |
DatePicker, TimePicker |
Additional views covered later
WebView
Picker
ListView
TableView
Not covered:
- Map
OpenGLView
Programs
Program SliderDemo
Page 372.
Concepts:
- Three public properties
- Minimum
- Maximum
- Value
fires ValueChanged
ValueChangedEventArgs has two values named OldValue and NewValue.
- recommend you add some padding at the left and right.
Pitfalls: Set the Maximum first, setting minimum greater than the default maximum causes an error. I.e. maximum > minimum == true.
Also:
Classes:
- Slider
Program RgbSliders
Page 377.
Concepts:
- Demo's slider with Color classes.
Program TextFade
Page 380.
- Another slider demo on the alpha channel.
Program StepperDemo
Page 383.
Concepts:
Adds an Increment property to allow an incremental value other than 1.
Program SwitchDemo
Page 385.
Concepts:
Introduces the Switch
Property: IsToggled of type bool.
- Event: Toggled
Classes:
- Switch
Program CheckBoxDemo
Page 387.
Concepts:
- Properties:
Text
FontSize
IsChecked
Event: IsCheckedChanged
Classes:
CheckBox is similar to the the switch, but the text identifier is par to of the visual.
Typing Text
- Entry (Horizontal scrolling)
- Editor ((Default wrapping and vertical scrolling)
SearchBar (Horizontal scrolling)
Methods/Properties:
Focus --> returns true if element receives focus
UnFocus --> removes input focus from element
IsFocused --> read only, true if visual element currently has input focus
Focused --> Event is fired when a visual element acquires input focus.
Unfocused --> Event is fired when a visual element loses input focus.
Property --> Keyboard, tells about the type of
There exists different keyboards
- Default
- Text
- Chat
- Url
- Telephone
- Numeric (positive numbers only)
Program EntryKeyboards
Page 395.
Concepts:
You don’t want to set HorizontalOptions on an Entry to Left, Cen-ter, or Right unless you
also set the WidthRequest property
- Hence, always put data entry views in a scroll view!
Properties:
- Text - the string that appears in the Entry
TextColor - a Color value
IsPassword - a Boolean that causes characters to be masked right after they’re typed
- Placeholder - light-colored text that appears in the Entry but disappears as soon as the user begins typing.
Events:
- Completed
Classes: Entry
Program QuadraticEquations
Page 397.
Notice the platform-specific WidthRequest setting in the implicit Style for the Entry. This gives each Entry a one-inch width.
Concepts:
- Demo of Entry.
Program JustNotes
Page 404.
This is the most basic program that Android starts with on their site...
Another simple demo of the Entry. Introduces Keyboard configuration.
Program SearchBar
Page 406.
Concepts:
- Demos a search bar for searching a text document.
Classes:
SearchBar
Program DaysBetweenDates
Page 411.
Concepts:
Demos DatePicker.
- Calculates days between dates.
Classes:
DatePicker
Program SetTimer
Page 415.
Concepts:
- How to display an alert.
How to use the TimePicker
Classes:
DisplayAlert page 416.