I have basic xamarin.mac app and I don’t know how to change his background color.
// viewcontroller.cs (c#)
using System;
using AppKit;
using Foundation;
namespace Application
{
public partial class ViewController : NSViewController
{
public ViewController (IntPtr handle) : base (handle)
{
}
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Do any additional setup after loading the view.
labelOnChange.StringValue = "";
textFieldOnChange.Changed += LabelChanged;
}
public override NSObject RepresentedObject {
get {
return base.RepresentedObject;
}
set {
base.RepresentedObject = value;
// Update the view, if already loaded.
}
}
void LabelChanged(object sender, EventArgs e)
{
// get the new value
labelOnChange.StringValue = textFieldOnChange.StringValue;
}
partial void buttonClear(NSObject sender)
{
textFieldOnChange.StringValue = "";
labelOnChange.StringValue = "";
}
}
}
Is there simple label which can change bg color, like in Xcode interface builder or I have to write it yourself in viewcontroller.cs (in VS)?
I was try to find NSWindow object which have relation to my project, and to use his backgroundcolor method, but I didn’t find him
New contributor
Алексей Фидотов is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.