summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.MacOS/Cells/ViewCellRenderer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.MacOS/Cells/ViewCellRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.MacOS/Cells/ViewCellRenderer.cs46
1 files changed, 46 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.MacOS/Cells/ViewCellRenderer.cs b/Xamarin.Forms.Platform.MacOS/Cells/ViewCellRenderer.cs
new file mode 100644
index 0000000..8b34518
--- /dev/null
+++ b/Xamarin.Forms.Platform.MacOS/Cells/ViewCellRenderer.cs
@@ -0,0 +1,46 @@
+´╗┐using System.ComponentModel;
+using AppKit;
+
+// ReSharper disable UnusedParameter.Local
+
+namespace Xamarin.Forms.Platform.MacOS
+{
+ public class ViewCellRenderer : CellRenderer
+ {
+ public override NSView GetCell(Cell item, NSView reusableView, NSTableView tv)
+ {
+ var viewCell = (ViewCell)item;
+
+ var cell = reusableView as ViewCellNSView;
+ if (cell == null)
+ cell = new ViewCellNSView();
+ else
+ cell.ViewCell.PropertyChanged -= ViewCellPropertyChanged;
+
+ viewCell.PropertyChanged += ViewCellPropertyChanged;
+ cell.ViewCell = viewCell;
+
+ SetRealCell(item, cell);
+
+ WireUpForceUpdateSizeRequested(item, cell, tv);
+
+ UpdateBackground(cell, item);
+ UpdateIsEnabled(cell, viewCell);
+ return cell;
+ }
+
+ static void UpdateIsEnabled(ViewCellNSView cell, ViewCell viewCell)
+ {
+ //TODO: Implement IsEnabled on ViewCell
+ }
+
+ static void ViewCellPropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ var viewCell = (ViewCell)sender;
+ var realCell = (ViewCellNSView)GetRealCell(viewCell);
+
+ if (e.PropertyName == Cell.IsEnabledProperty.PropertyName)
+ UpdateIsEnabled(realCell, viewCell);
+ }
+ }
+} \ No newline at end of file