Hi all,
I am a bit confused about using datagrid and tabview together. I want to use datagrid inside a tabview object but when I place a datagrid into the tabview, content is not shown, only blank white space is shown. I have no any problem If I use datagrid out of tabview, it works well and show all content that I want.
Edit: I am using version 16.1.0.26.
Here is my codes:
public partial class TestClass: ContentPage
{
private SfTabView tabView;
SfDataGrid sfGrid = new SfDataGrid();
SfDataPager sfPager = new SfDataPager();
public TestMethod()
{
sfGrid.Columns.Add(new GridTextColumn() { HeaderText = "Test1", MappingName = "Test1" });
sfGrid.Columns.Add(new GridTextColumn() { HeaderText = "Test2", MappingName = "Test2" });
sfGrid.Columns.Add(new GridTextColumn() { HeaderText = "Test3", MappingName = "Test3" });
sfPager.PageSize = 10;
sfPager.Source = modelData;
sfPager.AppearanceManager = new DataGridPagerCustomization();
sfGrid.ItemsSource = sfPager.PagedSource;
sfGrid.ColumnSizer = ColumnSizer.Star;
sfGrid.AllowSorting = true;
sfGrid.AutoGenerateColumns = false;
sfGrid.AllowResizingColumn = true;
sfGrid.AllowSwiping = false;
sfGrid.SelectionMode = SelectionMode.SingleDeselect;
sfGrid.SelectionChanged += sfGrid_SelectionChanged;
sfGrid.GridStyle = new DataGridCustomStyle();
Grid myGrid = new Grid();
myGrid.HorizontalOptions = LayoutOptions.FillAndExpand;
myGrid.BackgroundColor = Color.WhiteSmoke;
myGrid.Padding = new Thickness(0, 10, 0, 0);
myGrid.RowDefinitions = new RowDefinitionCollection
{
new RowDefinition { Height = 50 },
new RowDefinition {},
};
myGrid.Children.Add(sfPager, 0, 0);
myGrid.Children.Add(sfGrid, 0, 1);
tabView = new SfTabView();
var tabItems = new TabItemCollection
{
new SfTabItem()
{
Title = "Title1",
Content = myGrid
},
};
tabView.Items = tabItems;
this.Content = tabView;
}
}