Skip to content

Migrating UIKit Controls to XAML

Arnaud Montembault edited this page Jan 5, 2017 · 14 revisions

#Status of the migration of UIKit controls to XAML We announced back in July that part of our new UIKit approach included re-implementing the UIKit controls to have them backed by XAML controls. So far, we migrated UITextField, UISlider, UIActivityIndicatorView, UIScrollView and UIButton. We created issues on GitHub when publishing some of these changes but we also wanted to share here a full status of what has been done so far and what's coming next.

UITextField

The XAML-backed implementation of UITextField (using XAML Textbox and PasswordBox controls) was first released on May 5, 2016 and you can find more details about what methods and properties are supported with this implementation here. One thing we lost with the new implementation is the participation of the UITextField control in the iOS hit-testing mechanism. That means, for instance, that scrolling on a UITextField embedded in a view will no longer trigger the view to scroll. The view will only scroll if the gesture is being done outside of the UITextField.

UISlider

The XAML-backed implementation of UISlider (using a XAML Slider) was first released on July 5, 2016 and here's the list of changes that came with this new implementation:

Feature Previous Implementation XAML-backed Implementation
value Yes Yes
minimumValue Yes Yes
maximumValue Yes Yes
continuous Yes Yes
minimumTrackTintColor No No
maximumTrackTintColor No No
thumbTintColor No Yes
minimumValueImage Yes No
maximumValueImage Yes No
currentMinimumTrackImage Yes No
currentMaximumTrackImage No No
currentThumbImage Yes No
- setValue:animated: Partial Partial
- setMaximumTrackImage:forState: Yes No
- setMinimumTrackImage:forState: Yes No
- setThumbImage:forState: Yes No
- thumbImageForState: No No
- maximumTrackImageForState: No No
- minimumTrackImageForState: No No
trackRectForBounds No No
minimumValueImageRectForBounds No No
maximumValueImageRectForBounds No No
thumbRectForBounds:trackRect:value No No

UIActivityIndicatorView

The XAML-backed implementation of UIActivityIndicatorView (using a XAML Progress Ring) was first released on July 5, 2016 and here's the list of changes that came with this new implementation:

Feature Previous Implementation XAML-backed Implementation
- initWithActivityIndicatorStyle Caveat Yes
- initWithCoder: Yes Yes
- initWithFrame: Yes Yes
- startAnimating Yes Yes
- stopAnimating Yes Yes
activityIndicatorViewStyle Yes Yes
color Yes Yes
hideWhenStopped Yes Caveat
isAnimating Yes Yes
UIActivityIndicatorViewStyleGray Yes Yes
UIActivityIndicatorViewStyleWhite Yes Yes
UIActivityIndicatorViewStyleWhiteLarge Yes Yes

UIScrollView

The XAML-backed implementation of UIScrollView (using a XAML ScrollViewer control) was first published on September 6, 2016 and here is the list of changes that came with this implementation:

Feature Previous Implementation XAML-backed Implementation
- setContentOffset:animated: Yes Yes
contentOffset Yes Yes
contentSize Yes Yes
contentInset Yes Yes
scrollEnabled Yes Yes
directionalLockEnabled No Yes
scrollsToTop No No
- scrollRectToVisible:animated: Yes Yes
pagingEnabled Yes Yes
bounces Yes No
alwaysBounceVertical Yes No
alwaysBounceHorizontal Yes No
- touchesShouldBegin:withEvent:inContentView: No No
- touchesShouldCancelInContentView: No No
delaysContentTouches No No
decelerationRate No No
dragging Yes Yes
tracking Yes Yes
decelerating Yes Yes
indicatorStyle No No
showsHorizontalScrollIndicator Yes Yes
showsVerticalScrollIndicator Yes Yes
- flashScrollIndicators No No
panGestureRecognizer Yes No
pinchGestureRecognizer Yes No
- zoomToRect:animated: Yes Yes
zoomScale Yes Yes
- setZoomScale:animated: Yes Yes
maximumZoomScale Yes Yes
minimumZoomScale Yes Yes
zoomBouncing Yes No
zooming Yes Yes
bouncesZoom Yes No
Double tap auto-zooming Yes Yes
delegate Yes Yes
- scrollViewDidScroll: Yes Yes
- scrollViewWillBeginDragging: Yes Yes
- scrollViewWillEndDragging:withVelocity:targetContentOffset: Yes Yes
- scrollViewDidEndDragging:willDecelerate: Yes Yes
- scrollViewShouldScrollToTop: No No
- scrollViewDidScrollToTop: No No
- scrollViewWillBeginDecelerating: Yes Yes
- scrollViewDidEndDecelerating: Yes Yes
- viewForZoomingInScrollView: Yes Yes
- scrollViewWillBeginZooming:withView: Yes Yes
- scrollViewDidEndZooming:withView:atScale: Yes Yes
- scrollViewDidZoom: Yes Yes
- scrollViewDidEndScrollingAnimation: Yes Yes
keyboardDismissMode No No

UIButton

The XAML-backed implementation of UIButton (using a XAML Image and a XAML TextBlock controls) was first published on November 7,2016 and here is the list of changes that came with this implementation. It's also worth noting that the default behavior where a system type UIButton will be dimmed when pressed on iOS is not supported by the bridge (but this behavior can easily be implemented in your app).

Feature Previous Implementation XAML-backed Implementation
adjustsImageWhenDisabled No No
adjustsImageWhenHighlighted No No
- attributedTitle:forState No No
- backgroundImageForState: Yes Yes
- backgroundRectForBounds: No No
buttonType Yes No
+ buttonWithType: Yes Caveat: Type not fully supported
contentEdgeInsets Yes Yes
- contentRectForBounds: Yes Yes
currentAttributedTitle No No
currentBackgroundImage Yes Yes
currentImage Yes Yes
currentTitle Yes Yes
currentTitleColor Yes Yes
currentTitleShadowColor No No
font Yes Yes
imageEdgeInsets Yes Yes
- imageForState: Yes Yes
- imageRectForContentRect: Yes Yes
imageView Yes Caveat: Returns a mock UIImageView that proxies some common properties and selectors to the underlying Image
lineBreakMode No No
reversesTitleShadowWhenHighlighted No No
- setAttributedTitle:forState No No
- setBackgroundImage:forState Yes Yes
- setImage:forState: Yes Yes
- setTitle:forState: Yes Yes
- setTitleColor:forState: Yes Yes
- setTitleShadowColor:forState: No No
showsTouchWhenHighlighted No No
tintColor No No
- titleColorForState: Yes Yes
titleEdgeInsets Yes Yes
- titleForState: Yes Yes
titleLabel Yes Caveat: Returns a mock UILabel that proxies some common properties and selectors to the underlying TextBlock
- titleRectForContentRect: Yes Yes
- titleShadowColorForState: No No
titleShadowOffset No No
touchesBegan:withEvent: Yes Yes
touchesCancelled:withEvent: Yes Yes
touchesEnded:withEvent: Yes Yes
touchesMoved:withEvent: Yes Yes