2016-06-10 1 views
0

iOS 및 Windows Phone 용 Xamarin.Forms로 만든 Android 앱을 변환하는 중입니다.Xamarin.Forms로 편집 불가능한 테이블 만들기

것은 내가 할 노력하고있어 무엇 :

enter image description here

내가 간단한 2 열 넓은 테이블을 만들고 싶어. 나는 this guide을 따라 갔지만 엔트리 셀은 속성을 편집 할 수 없도록 편집 할 수있었습니다. 코드를 통해이 항목을 쉽게 수정할 수 있어야합니다.

내가 현재 가지고있는 : 이미

enter image description here

이 또한 내 textentry

후 임의 라인의 무리를 추가 스크린 샷을 확인하는 TextCell, 같은 거래를 시도 :

var section = new TableSection() { 
    new EntryCell { Label = "Chest", Text = "0" }, 
}; 

TableView tableView = new TableView 
     { 
      IsEnabled = false, 
      Root = new TableRoot 
      { 
       section 
      } 
     }; 

편집을

enter image description here

완벽한 세상에서 나는 HTML 테이블과 비슷한 것을 원합니다.

나는 누군가가 listview를 제안한 다른 스레드를 보았지만 어떻게 테이블을 만들 수 있는지 알지 못한다.

나는 그리드와 다양한 설정을 시도하지만, 나는 누군가가 더 나은 솔루션을 경우 며칠 동안 허용 대답으로이 마킹 아니에요

 Grid grid = new Grid 
     { 
      VerticalOptions = LayoutOptions.FillAndExpand, 
      RowDefinitions = 
      { 
       new RowDefinition { Height = new GridLength(100, GridUnitType.Absolute) } 
      }, 
      ColumnDefinitions = 
      { 
       new ColumnDefinition { Width = new GridLength(100, GridUnitType.Absolute) }, 
       new ColumnDefinition { Width = new GridLength(100, GridUnitType.Absolute) } 
      } 
     }; 
     grid.Children.Add(txtChest); 
     grid.Children.Add(txtChestResults); 
+3

는 EntryCell 대신 TextCell을 사용하여 최종 결과는 다음과 같이 보인다. – Jason

+0

이미 시도했지만 텍스트를 수정할 수 있습니다. 내가 가장 최근에 편집 한 내용을 봅니다. –

+0

죄송하지만 TextCell은 편집을 허용하지 않습니다. 단순히 텍스트를 표시하기위한 것입니다. –

답변

0

를 작동하지 않는 것 . 나는이 "테이블"에 또 다른 칼럼을 추가해야만했기 때문에이 솔루션이 효과가 없을 것이므로 제안을 할 수있다.

이 날짜 (2016 년 6 월 11 일) 현재 TableView는 너무 실용적입니다. 여분의 공간에 대해 지속적으로 불만이 있습니다. 또한 텍스트 뷰를 터치하면 작업을 수행하는 것처럼 보입니다 (비디오없이 설명하기가 어렵습니다). 그것들은 정적 텍스트이고, 만지면 반응하지 않아야합니다.

간단한 2 열 테이블을 만드는 방법은 다음과 같습니다 (기존 테이블보다 더 많은 테이블 형식이긴하지만). Cliffnotes? 1 개의 수직 방향의 StackLayout 내에 몇개의 수평 방향의 StackLayout가 있습니다. 맨 왼쪽에 하나의 레이블을 배치하고 맨 오른쪽에 다른 레이블을 배치합니다. enter image description here

//Result Items 

/* Start chest */ 
Label txtChest = new Label 
{ 
    Text = "Chest", 
    VerticalOptions = LayoutOptions.CenterAndExpand, 
    HorizontalOptions = LayoutOptions.StartAndExpand 

}; 
Label txtChestResults = new Label 
{ 
    Text = "0", 
    VerticalOptions = LayoutOptions.CenterAndExpand, 
    HorizontalOptions = LayoutOptions.EndAndExpand 

}; 
/* End chest */ 

/* Start Biceps */ 
Label txtBiceps = new Label 
{ 
    Text = "Biceps", 
    VerticalOptions = LayoutOptions.CenterAndExpand, 
    HorizontalOptions = LayoutOptions.StartAndExpand 
}; 
Label txtBicepsResults = new Label 
{ 
    Text = "0", 
    VerticalOptions = LayoutOptions.CenterAndExpand, 
    HorizontalOptions = LayoutOptions.EndAndExpand 

}; 
/* End Biceps */ 

/* Start Forearms */ 
Label txtForearms = new Label 
{ 
    Text = "Forearms", 
    VerticalOptions = LayoutOptions.CenterAndExpand, 
    HorizontalOptions = LayoutOptions.StartAndExpand 
}; 
Label txtForearmsResults = new Label 
{ 
    Text = "0", 
    VerticalOptions = LayoutOptions.CenterAndExpand, 
    HorizontalOptions = LayoutOptions.EndAndExpand 
}; 
/* End Forearms */ 


/* Start Neck */ 
Label txtNeck = new Label 
{ 
    Text = "Neck", 
    VerticalOptions = LayoutOptions.CenterAndExpand, 
    HorizontalOptions = LayoutOptions.StartAndExpand 
}; 
Label txtNeckResults = new Label 
{ 
    Text = "0", 
    VerticalOptions = LayoutOptions.CenterAndExpand, 
    HorizontalOptions = LayoutOptions.EndAndExpand 
}; 
/* End Neck */ 


/* Start Thighs */ 
Label txtThighs = new Label 
{ 
    Text = "Thighs", 
    VerticalOptions = LayoutOptions.CenterAndExpand, 
    HorizontalOptions = LayoutOptions.StartAndExpand 
}; 
Label txtThighsResults = new Label 
{ 
    Text = "0", 
    VerticalOptions = LayoutOptions.CenterAndExpand, 
    HorizontalOptions = LayoutOptions.EndAndExpand 
}; 
/* End Thighs */ 

/* Start Calves */ 
Label txtCalves = new Label 
{ 
    Text = "Calves", 
    VerticalOptions = LayoutOptions.CenterAndExpand, 
    HorizontalOptions = LayoutOptions.StartAndExpand 
}; 
Label txtCalvesResults = new Label 
{ 
    Text = "0", 
    VerticalOptions = LayoutOptions.CenterAndExpand, 
    HorizontalOptions = LayoutOptions.EndAndExpand 
}; 
/* End Calves */ 

//Chest StackLayout 
StackLayout chestLayout = new StackLayout 
{ 
    Orientation = StackOrientation.Horizontal 
}; 
chestLayout.Children.Add(txtChest); 
chestLayout.Children.Add(txtChestResults); 


//biceps layout 
StackLayout bicepsLayout = new StackLayout 
{ 
    Orientation = StackOrientation.Horizontal 
}; 
bicepsLayout.Children.Add(txtBiceps); 
bicepsLayout.Children.Add(txtBicepsResults); 


//forearms layout 
StackLayout forearmsLayout = new StackLayout 
{ 
    Orientation = StackOrientation.Horizontal 
}; 
forearmsLayout.Children.Add(txtForearms); 
forearmsLayout.Children.Add(txtForearmsResults); 


//Neck layout 
StackLayout neckLayout = new StackLayout 
{ 
    Orientation = StackOrientation.Horizontal 
}; 
neckLayout.Children.Add(txtNeck); 
neckLayout.Children.Add(txtNeckResults); 


//Thighs layout 
StackLayout thighsLayout = new StackLayout 
{ 
    Orientation = StackOrientation.Horizontal 
}; 
thighsLayout.Children.Add(txtThighs); 
thighsLayout.Children.Add(txtThighsResults); 

//Calves layout 
StackLayout calvesLayout = new StackLayout 
{ 
    Orientation = StackOrientation.Horizontal 
}; 
calvesLayout.Children.Add(txtCalves); 
calvesLayout.Children.Add(txtCalvesResults); 

StackLayout resultsLayout = new StackLayout 
{ 
    Orientation = StackOrientation.Vertical 
}; 
resultsLayout.Children.Add(chestLayout); 
resultsLayout.Children.Add(bicepsLayout); 
resultsLayout.Children.Add(forearmsLayout); 
resultsLayout.Children.Add(neckLayout); 
resultsLayout.Children.Add(thighsLayout); 
resultsLayout.Children.Add(calvesLayout); 


//add chest results 
layout.Children.Add(resultsLayout); 
관련 문제