private void ShowDetailPanel(DataGrid dataGrid)
        {
            if (cacheDetailPanels.ContainsKey(dataGrid) && swDetail.Content == cacheDetailPanels[dataGrid])
            {
                return;
            }

            DetailPanel detail;

            if (!cacheDetailPanels.TryGetValue(dataGrid, out detail))
            {
                Type typeObj;
                if (dataGrid == gridContact)
                {
                    typeObj = typeof(Contact);
                }
                else if (dataGrid == gridLead)
                {
                    typeObj = typeof(Lead);
                }
                else if (dataGrid == gridActivity)
                {
                    typeObj = typeof(Activity);
                }
                else
                {
                    throw new ArgumentOutOfRangeException("dataGrid");
                }
                cacheDetailPanels[dataGrid] = detail = new DetailPanel(typeObj, dataGrid);
            }

            if (detail.Target != dataGrid.SelectedItems)
            {
                detail.Target = dataGrid.SelectedItems;
            }

            swDetail.Content = detail;
        }
        private void ShowDetailPanel(DataGrid dataGrid)
        {
            if (cacheDetailPanels.ContainsKey(dataGrid) && swDetail.Content == cacheDetailPanels[dataGrid]) return;

            DetailPanel detail;
            if (!cacheDetailPanels.TryGetValue(dataGrid, out detail))
            {
                Type typeObj;
                if (dataGrid == gridContact)
                    typeObj = typeof(Contact);
                else if (dataGrid == gridLead)
                    typeObj = typeof(Lead);
                else if (dataGrid == gridActivity)
                    typeObj = typeof(Activity);
                else
                    throw new ArgumentOutOfRangeException("dataGrid");
                cacheDetailPanels[dataGrid] = detail = new DetailPanel(typeObj, dataGrid);
            }

            if (detail.Target != dataGrid.SelectedItems)
                detail.Target = dataGrid.SelectedItems;

            swDetail.Content = detail;
        }