Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
using System;
using Cirrious.CrossCore.Core;
using Cirrious.MvvmCross.Binding.BindingContext;
using MonoMac.AppKit;
using MonoMac.Foundation;
namespace CentraStage.Mac
{
[Register("CsTableCellView")]
public class CsTableCellView : NSTableCellView, IMvxBindingContextOwner, IMvxDataConsumer
{
// Called when created from unmanaged code
public CsTableCellView (IntPtr handle) : base (handle)
{
Initialize (string.Empty);
}
// Called when created directly from a XIB file
[Export ("initWithCoder:")]
public CsTableCellView (NSCoder coder) : base (coder)
{
Initialize (string.Empty);
}
public CsTableCellView(string bindingText)
{
Initialize (bindingText);
}
// Shared initialization code
void Initialize (string bindingText)
{
this.CreateBindingContext(bindingText);
}
#region IMvxBindingContextOwner implementation
public IMvxBindingContext BindingContext {
get;
set;
}
#endregion
#region IMvxDataConsumer implementation
public object DataContext
{
get { return BindingContext.DataContext; }
set { BindingContext.DataContext = value; }
}
#endregion
public string Title {
get{
return this.TextField.StringValue;
}
set{
this.TextField.StringValue = value;
}
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
BindingContext.ClearAllBindings();
}
base.Dispose(disposing);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment