public void Remove(DataRow dataRow)
        {
            DataRowMetadata metadata = this.RowsMetadata.First(dr => dr.DataRow.Equals(dataRow));

            foreach (FrameworkElement control in metadata.Controls)
            {
                this.MainContent.Children.Remove(control);
            }
            this.MainContent.RowDefinitions.Remove(metadata.GridRow);
            this.Rows.Remove(metadata.DataRow);
            this.RowsMetadata.Remove(metadata);
        }
        public void AddRow(DataRow dataRow)
        {
            //Get data and create/init needed objects
            RowDefinition newRow = new RowDefinition()
            {
                Height = GridLength.Auto,
            };
            int             currentRowNumber = this.MainContent.RowDefinitions.Count - 1;
            DataRowMetadata metadata         = new DataRowMetadata()
            {
                Id                  = this.lastId++,
                DataRow             = dataRow,
                GridRow             = newRow,
                EntityNameTextBlock = new TextBlock()
                {
                    Text = dataRow.EntityName, Style = (Style)Resources["TableContent"],
                },
                EntityLogicalNameTextBlock = new TextBlock()
                {
                    Text = dataRow.EntityLogicalName, Style = (Style)Resources["TableContent"],
                },
                RoleTextBlock = new TextBlock()
                {
                    Text = dataRow.Role, Style = (Style)Resources["TableContent"],
                },
                ReadImage = new Image()
                {
                    Source = this.Converter.Convert(dataRow.Read), ToolTip = dataRow.Read, Style = (Style)Resources["RoleStatus"],
                },
                WriteImage = new Image()
                {
                    Source = this.Converter.Convert(dataRow.Write), ToolTip = dataRow.Write, Style = (Style)Resources["RoleStatus"],
                },
                DeleteImage = new Image()
                {
                    Source = this.Converter.Convert(dataRow.Delete), ToolTip = dataRow.Delete, Style = (Style)Resources["RoleStatus"],
                },
                AppendImage = new Image()
                {
                    Source = this.Converter.Convert(dataRow.Append), ToolTip = dataRow.Append, Style = (Style)Resources["RoleStatus"],
                },
                AppendToImage = new Image()
                {
                    Source = this.Converter.Convert(dataRow.AppendTo), ToolTip = dataRow.AppendTo, Style = (Style)Resources["RoleStatus"],
                },
                AssignImage = new Image()
                {
                    Source = this.Converter.Convert(dataRow.Assign), ToolTip = dataRow.Assign, Style = (Style)Resources["RoleStatus"],
                },
                ShareImage = new Image()
                {
                    Source = this.Converter.Convert(dataRow.Share), ToolTip = dataRow.Share, Style = (Style)Resources["RoleStatus"],
                },
                Rectangle = new Rectangle()
                {
                    Style = (Style)Resources["Line"],
                },
            };

            Grid.SetColumn(metadata.EntityNameTextBlock, 0);
            Grid.SetColumn(metadata.EntityLogicalNameTextBlock, 1);
            Grid.SetColumn(metadata.RoleTextBlock, 2);
            Grid.SetColumn(metadata.ReadImage, 3);
            Grid.SetColumn(metadata.WriteImage, 4);
            Grid.SetColumn(metadata.DeleteImage, 5);
            Grid.SetColumn(metadata.AppendImage, 6);
            Grid.SetColumn(metadata.AppendToImage, 7);
            Grid.SetColumn(metadata.AssignImage, 8);
            Grid.SetColumn(metadata.ShareImage, 9);

            //Add to table data row
            this.RowsMetadata.Add(metadata);
            this.Rows.Add(dataRow);
            this.MainContent.RowDefinitions.Add(newRow);
            foreach (FrameworkElement control in metadata.Controls)
            {
                Grid.SetRow(control, currentRowNumber);
                this.MainContent.Children.Add(control);
            }
        }