From 81f1c76efd4f787c50399630e2a100110e6d7251 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Thu, 15 Mar 2018 03:27:35 +0100 Subject: [PATCH] root data level --- src/GraphicObjects/GraphicObject.cs | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 2533fb1b..f404b5f1 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -298,6 +298,7 @@ namespace Crow bool cacheEnabled = false; bool clipToClientRect = true; protected object dataSource; + bool rootDataLevel; string style; object tag; bool isDragged; @@ -944,19 +945,36 @@ namespace Crow if (dse.NewDataSource == dse.OldDataSource) return; - - OnDataSourceChanged (this, dse); - - NotifyValueChanged ("DataSource", DataSource); + if (value != null) + rootDataLevel = true; + + lock (IFace.LayoutMutex) { + OnDataSourceChanged (this, dse); + NotifyValueChanged ("DataSource", DataSource); + } } get { - return dataSource == null ? + return rootDataLevel ? dataSource : dataSource == null ? LogicalParent == null ? null : LogicalParent is GraphicObject ? (LogicalParent as GraphicObject).DataSource : null : dataSource; } } + /// + /// If true, rendering of GraphicObject is clipped inside client rectangle + /// + [DesignCategory ("Data")][DefaultValue(false)] + public virtual bool RootDataLevel { + get { return rootDataLevel; } + set { + if (rootDataLevel == value) + return; + rootDataLevel = value; + NotifyValueChanged ("RootDataLevel", rootDataLevel); + this.RegisterForRedraw (); + } + } protected virtual void onLogicalParentDataSourceChanged(object sender, DataSourceChangeEventArgs e){ if (localDataSourceIsNull) OnDataSourceChanged (this, e); -- 2.47.3