/// <summary>
        /// Method which initialize the element with respect corresponding UnBound value
        /// </summary>
        /// <param name="dataColumn">DataColumn which holds GridColumn, RowColumnIndex and GridCell </param>
        /// RowColumnIndex - RowColumnIndex for the Renderer Element
        /// <param name="uiElement">Corresponding Renderer Element</param>
        /// GridColumn - Column which is providing the information for Binding
        /// <param name="dataContext">DataContext of the row</param>
        /// <remarks></remarks>
        public override void OnInitializeEditElement(DataColumnBase dataColumn, ContentControl uiElement, object dataContext)
        {
            var    column       = dataColumn.GridColumn as GridUnBoundColumn;
            object contentValue = null;

            if (dataContext != null)
            {
                contentValue = DataGrid.GetUnBoundCellValue(column, dataContext);
            }
            if (column.hasEditTemplate)
            {
                uiElement.ContentTemplate = column.EditTemplate;
            }
            if (column.hasEditTemplateSelector)
            {
                uiElement.ContentTemplateSelector = column.EditTemplateSelector;
            }
            var dataContextHelper = new DataContextHelper
            {
                Record = dataContext,
                Value  = contentValue
            };

            uiElement.Content = dataContextHelper;
            CanFocus          = true;
        }
        public override void OnUpdateTemplateBinding(DataColumnBase dataColumn, ContentControl uiElement, object dataContext)
        {
            uiElement.ClearValue(ContentControl.ContentProperty);
            var dataContextHelper = new DataContextHelper {
                Record = dataContext
            };

            dataContextHelper.SetValueBinding(dataColumn.GridColumn.DisplayBinding, dataContext);
            uiElement.Content = dataContextHelper;
        }
        /// <summary>
        /// Called when [initialize edit element].
        /// </summary>
        /// <param name="dataColumn">DataColumn Which holds GridColumn, RowColumnIndex and GridCell </param>
        /// RowColumnIndex - RowColumnIndex for the Renderer Element
        /// <param name="uiElement">Corresponding Renderer Element</param>
        /// GridColumn - Column which is providing the information for Binding
        /// <param name="dataContext">The data context.</param>
        public override void OnInitializeEditElement(DataColumnBase dataColumn, ContentControl uiElement, object dataContext)
        {
            base.OnInitializeEditElement(dataColumn, uiElement, dataContext);
            uiElement.ClearValue(ContentControl.ContentProperty);
            var dataContextHelper = new DataContextHelper {
                Record = dataContext
            };

            dataContextHelper.SetValueBinding(dataColumn.GridColumn.ValueBinding, dataContext);
            uiElement.Content = dataContextHelper;
        }
        public override void OnUpdateTemplateBinding(DataColumnBase dataColumn, ContentControl uiElement, object dataContext)
        {
            var column            = dataColumn.GridColumn;
            var contentValue      = DataGrid.GetUnBoundCellValue(column, dataContext);
            var dataContextHelper = new DataContextHelper
            {
                Record = dataContext,
                Value  = contentValue
            };

            uiElement.Content = dataContextHelper;
        }
        /// <summary>
        /// Initializes the cell style.
        /// </summary>
        /// <param name="dataColumn">DataColumn Which holds GridColumn, RowColumnIndex and GridCell </param>
        /// RowColumnIndex - RowColumnIndex for the Renderer Element
        /// GridColumn - Column which is providing the information for Binding
        /// <param name="record">The record.</param>
        protected override void InitializeCellStyle(DataColumnBase dataColumn, object record)
        {
            base.InitializeCellStyle(dataColumn, record);
            var uiElement  = (dataColumn.ColumnElement as GridCell).Content as ContentControl;
            var gridColumn = dataColumn.GridColumn as GridTemplateColumn;

            if (uiElement != null && gridColumn != null)
            {
                uiElement.ClearValue(ContentControl.ContentProperty);
                var dataContextHelper = new DataContextHelper {
                    Record = record
                };
                dataContextHelper.SetValueBinding(gridColumn.ValueBinding, record);
                uiElement.Content = dataContextHelper;
            }
        }
        public override void OnUpdateEditBinding(DataColumnBase dataColumn, ContentControl uiElement, object dataContext)
        {
            GridColumn column = dataColumn.GridColumn;

            if (column.SetCellBoundValue)
            {
                var dataContextHelper = new DataContextHelper {
                    Record = dataContext
                };
                dataContextHelper.SetValueBinding(column.ValueBinding, dataContext);
                uiElement.Content = dataContextHelper;
            }
            else
            {
                uiElement.SetBinding(ContentControl.ContentProperty, new Binding());
            }
        }
        /// <summary>
        /// Method which initialize the element with respect corresponding UnBound value
        /// </summary>
        /// <param name="dataColumn">DataColumn which holds GridColumn, RowColumnIndex and GridCell </param>
        /// RowColumnIndex - RowColumnIndex for the Renderer Element
        /// <param name="uiElement">Corresponding Renderer Element</param>
        /// <param name="dataContext"></param>
        /// GridColumn - Column which is providing the information for Binding
        /// <remarks></remarks>
        public override void OnInitializeEditElement(DataColumnBase dataColumn, ContentControl uiElement, object dataContext)
        {
            object contentValue = null;

            contentValue = (dataColumn.GridUnBoundRowEventsArgs != null && dataColumn.GridUnBoundRowEventsArgs.Value != null) ?
                           dataColumn.GridUnBoundRowEventsArgs.Value.ToString() :
                           string.Empty;

            CanFocus = true;
            uiElement.ContentTemplate = dataColumn.GridUnBoundRowEventsArgs != null &&
                                        dataColumn.GridUnBoundRowEventsArgs.hasEditTemplate ?
                                        dataColumn.GridUnBoundRowEventsArgs.EditTemplate : null;

            var dataContextHelper = new DataContextHelper
            {
                Record = dataColumn.GridUnBoundRowEventsArgs,
                Value  = contentValue
            };

            uiElement.Content = dataContextHelper;
        }
        /// <summary>
        /// Update Tool Tip which show tool tip when mouse enter on GridUnBoundRowCell.
        /// </summary>
        /// <param name="dataColumn">Which hold GridUnBoundRowCell, GridColumn and Cell's row Column index</param>
        public override void UpdateToolTip(DataColumnBase dataColumn)
        {
            var uiElement = dataColumn.ColumnElement;
            var column    = dataColumn.GridColumn;

            if (column == null || !column.ShowToolTip)
            {
                uiElement.ClearValue(ToolTipService.ToolTipProperty);
                return;
            }
            var     obj = ToolTipService.GetToolTip(uiElement);
            ToolTip tooltip;

            if (obj is ToolTip)
            {
                tooltip = obj as ToolTip;
            }
            else
            {
                tooltip = new ToolTip();
            }
            var dataContext = dataColumn.GridUnBoundRowEventsArgs;

            if (column.hasToolTipTemplate || column.hasToolTipTemplateSelector)
            {
                if (column.SetCellBoundToolTip)
                {
                    var dataContextHelper = new DataContextHelper
                    {
                        Record = dataContext,
                        Value  = dataContext.Value
                    };
                    tooltip.Content = dataContextHelper;

                    if (column.hasToolTipTemplate)
                    {
                        tooltip.ContentTemplate = column.ToolTipTemplate;
                    }
                    else if (column.hasToolTipTemplateSelector)
                    {
                        tooltip.ContentTemplateSelector = column.ToolTipTemplateSelector;
                    }
                }
                else
                {
                    tooltip.Content = dataContext.Value;
                }
            }
            else
            {
                var displayText = Convert.ToString(dataContext.Value);
                tooltip.Content = displayText;
                if (string.IsNullOrEmpty(displayText))
                {
                    tooltip.IsEnabled = false;
                }
            }
            //Specifies to raise tooltip opening event for the corresponding cell
            if (dataColumn.RaiseCellToolTipOpening(tooltip))
            {
                ToolTipService.SetToolTip(uiElement, tooltip);
            }
            else
            {
                uiElement.ClearValue(ToolTipService.ToolTipProperty);
            }
        }
        /// <summary>
        /// Updates the tool tip for GridCell.
        /// </summary>
        /// <param name="dataColumn">Which holds GridColumn, Row Column Index and GridCell</param>
        public override void UpdateToolTip(DataColumnBase dataColumn)
        {
            var uiElement = dataColumn.ColumnElement;
            var column    = dataColumn.GridColumn;

            if (dataColumn.IsEditing || column == null || !column.ShowToolTip ||
                this is GridSummaryCellRenderer || this is GridCaptionSummaryCellRenderer ||
                this is GridTableSummaryCellRenderer)
            {
                uiElement.ClearValue(ToolTipService.ToolTipProperty);
                return;
            }

            object  dataContext = dataColumn.ColumnElement.DataContext;
            var     obj         = ToolTipService.GetToolTip(uiElement);
            ToolTip tooltip;

            if (obj is ToolTip)
            {
                tooltip = obj as ToolTip;
            }
            else
            {
                tooltip = new ToolTip();
            }
            if (column.hasToolTipTemplate || column.hasToolTipTemplateSelector)
            {
                if (column.SetCellBoundToolTip)
                {
                    var dataContextHelper = new DataContextHelper {
                        Record = dataContext
                    };
                    dataContextHelper.SetValueBinding(column.DisplayBinding, dataContext);
                    tooltip.Content = dataContextHelper;
                }
                else
                {
                    tooltip.Content = dataContext;
                }

                if (column.hasToolTipTemplate)
                {
                    tooltip.ContentTemplate = column.ToolTipTemplate;
                }
                else if (column.hasToolTipTemplateSelector)
                {
                    tooltip.ContentTemplateSelector = column.ToolTipTemplateSelector;
                }
            }
            else
            {
                //UWP-2846 - ToolTip value shown as namespace of the boolean instead of value either True or False for the CheckBoxColumn in UWP
                //So removed the code to set binding for ToolTip and assigned the cell value directly to the Content property
                //tooltip.SetBinding(ContentControl.ContentProperty, column.DisplayBinding);
                var provider = column.DataGrid.View.GetPropertyAccessProvider();
                if (provider != null)
                {
                    var displayText = Convert.ToString(provider.GetDisplayValue(dataColumn.ColumnElement.DataContext, column.MappingName, column.UseBindingValue));
                    tooltip.Content = displayText;
                    if (string.IsNullOrEmpty(displayText))
                    {
                        tooltip.IsEnabled = false;
                    }
                }
            }
            //WPF -23277 Unbound column display and value binding has been created based on its dummy mapping name. hence this content will be null.
            // so that have set the tooltip content directly for unbound column
            if (column.IsUnbound)
            {
                var unboundCellValue = Convert.ToString(this.DataGrid.GetUnBoundCellValue(column, dataColumn.ColumnElement.DataContext));
                tooltip.Content = unboundCellValue;
                if (string.IsNullOrEmpty(unboundCellValue))
                {
                    tooltip.IsEnabled = false;
                }
            }
            //Specifies to raise tooltip opening event for the corresponding cell
            if (dataColumn.RaiseCellToolTipOpening(tooltip))
            {
                ToolTipService.SetToolTip(uiElement, tooltip);
            }
            else
            {
                uiElement.ClearValue(ToolTipService.ToolTipProperty);
            }
        }