Skip to content

Commit 89ec5fe

Browse files
committed
XAML-backed controls - hook up XAML markup to the UIViewController via outlets
CHANGES ======= 1. XamlUtilities contains XAML helper methods: ReturnXamlType and GenerateUIKitControlfromXamlType 2. Added initWithFrame:xamlControl: to UISlider and UITextField 3. Modified sample app, XAMLTest, to exercise UIKit controls updating label text as other controls are manipulated 4. Checked in a binary drop of Xib2Xaml.EXE and XamlTools.DLL TESTS ===== Unit tests PASSED XAMLTest (desktop/ARM) and WOCCatalog verified (desktop)
1 parent ad59a1d commit 89ec5fe

File tree

18 files changed

+341
-180
lines changed

18 files changed

+341
-180
lines changed

Frameworks/UIKit/UIActivityIndicatorView.mm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,10 @@ - (BOOL)isAnimating {
224224
*/
225225
- (void)setColor:(UIColor*)color {
226226
_color = color;
227-
[_progressRing setForeground:[WUXMSolidColorBrush makeInstanceWithColor:[XamlUtilities convertUIColorToWUColor:color]]];
227+
228+
WUColor* convertedColor = ConvertUIColorToWUColor(color);
229+
WUXMSolidColorBrush* brush = [WUXMSolidColorBrush makeInstanceWithColor:convertedColor];
230+
[_progressRing setForeground:brush];
228231
}
229232

230233
/**

Frameworks/UIKit/UISlider.mm

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ @implementation UISlider {
4242
EventRegistrationToken _valueChangedEvent;
4343
}
4444

45-
- (void)_UISlider_initInternal {
46-
_xamlSlider = [WXCSlider make];
45+
- (void)_UISlider_initInternal:(WXFrameworkElement*)xamlElement {
46+
if (xamlElement != nil && [xamlElement isKindOfClass:[WXCSlider class]]) {
47+
_xamlSlider = static_cast<WXCSlider*>(xamlElement);
48+
} else {
49+
_xamlSlider = [WXCSlider make];
50+
}
4751

4852
// BUG:7911911 - [XAMLCatalog] UISlider not rendering the right track image of XAML slider on ARM
4953
_xamlSlider.requestedTheme = WXElementThemeLight;
@@ -83,7 +87,7 @@ - (void)setFrame:(CGRect)frame {
8387
*/
8488
- (instancetype)initWithCoder:(NSCoder*)coder {
8589
if (self = [super initWithCoder:coder]) {
86-
[self _UISlider_initInternal];
90+
[self _UISlider_initInternal:nil];
8791

8892
if ([coder containsValueForKey:@"UIValue"]) {
8993
id valueStr = [coder decodeObjectForKey:@"UIValue"];
@@ -106,8 +110,12 @@ - (instancetype)initWithCoder:(NSCoder*)coder {
106110
@Status Interoperable
107111
*/
108112
- (instancetype)initWithFrame:(CGRect)frame {
113+
return [self _initWithFrame:frame xamlElement:nil];
114+
}
115+
116+
- (instancetype)_initWithFrame:(CGRect)frame xamlElement:(WXFrameworkElement*)xamlElement {
109117
if (self = [super initWithFrame:frame]) {
110-
[self _UISlider_initInternal];
118+
[self _UISlider_initInternal:xamlElement];
111119
}
112120

113121
return self;

Frameworks/UIKit/UITableView.mm

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,26 @@
3434
#import "UINibInternal.h"
3535
#import "CACompositor.h"
3636

37-
typedef id idweak;
38-
3937
static const wchar_t* TAG = L"UITableView";
4038

4139
NSString* const UITableViewIndexSearch = @"UITableViewIndexSearch";
40+
4241
/** @Status Stub */
4342
const CGFloat UITableViewAutomaticDimension = StubConstant();
4443

4544
UIKIT_EXPORT NSString* const UITableViewSelectionDidChangeNotification = @"UITableViewSelectionDidChangeNotification";
4645

47-
// narsty hack
46+
// TODO: Nasty hack
4847
extern id _curFirstResponder;
4948

50-
extern "C" bool doLog;
51-
5249
class VisibleComponent : public LLTreeNode<VisibleComponent, VisibleComponent> {
5350
public:
5451
TableViewNode* _node;
5552

5653
VisibleComponent(TableViewNode* node) {
5754
_node = node;
5855
}
56+
5957
~VisibleComponent();
6058
};
6159

0 commit comments

Comments
 (0)