The official documentation for Xamarin Forms Triggers can be found here. The documentation is great, however, triggers are written in XAML which I am not so fond of. I prefer to write the UI codes programmatically. If you are like me please continue reading.
There are four types of trigger. I will walk through each of them programatically.
Entry myEntry1 = new Entry
Placeholder = “Tap to focus…”,
PlaceholderColor = Color.White,
BackgroundColor = Color.FromHex(“#484848”),
TextColor = Color.White,
Margin = new Thickness(0, 0, 0, 20)
Trigger propertyTrigger = new Trigger(typeof(Entry));
propertyTrigger.Property = IsFocusedProperty;
propertyTrigger.Value = true;
Setter setter = new Setter();
setter.Property = BackgroundColorProperty;
Xamarin Support team says they don’t support “WatchOS storyboards in the VS Designer, with XCode 11 installed”, the only option to open storyboard is with Xcode Interface Builder from VS.
Now the problem I faced was while opening the storyboard for WatchOS with Xcode Interface Builder, I get the error “Error updating Xcode Project”.
Further looking into the log from VS->Help->Open Log Directory, I found the log as below:
ERROR [2019–12–17 13:32:01Z]: Error updating Xcode project
MonoDevelop.MacDev.ObjCIntegration.ObjectiveCGenerationException: Could not generate Objective-C code for action ‘DidChange’ in class ‘WatchTest.WatchKitExtension.CustomDatePicker’ as the type ‘System.nint’of …