From: Jean-Philippe Bruyère Date: Thu, 15 Mar 2018 02:27:35 +0000 (+0100) Subject: root data level X-Git-Tag: 0.7.3~4^2~4 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=81f1c76efd4f787c50399630e2a100110e6d7251;p=jp%2Fcrow.git root data level --- 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);