Skip to content

Instantly share code, notes, and snippets.

@deapsquatter
Created October 1, 2013 15:09
Show Gist options
  • Save deapsquatter/6779983 to your computer and use it in GitHub Desktop.
Save deapsquatter/6779983 to your computer and use it in GitHub Desktop.
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