안녕하세요 여러분 Windows Phone 8 application
에서 작업하고 있습니다. 여기에 텍스트 차단 텍스트를 배치하는 데 문제가 있습니다.wp8 public string은 프로그래밍 방식으로 만든 텍스트 블록에서 줄 바꿈하지 않습니다.
내 문자열 배열이 공개되지 않았을 때 포장이 잘 작동하는 반면 내 문자열 배열을 공용으로 만들면 포장이 작동하지 않습니다 ...!
오류를 찾을 수 없습니다.
내 코드는 여기
int a =1;
ScrollViewer scroll = new ScrollViewer();
string[] questions = new string[]
{ "Question :\n What is OOPS? \n\n Answer: \n Object-oriented programming (OOP) is a programming paradigm based on the concept of objects which are data structures that contain data in the form of fields often known as attributes and code in the form of procedures often known as methods. There are a few principle concepts that form the foundation of object-oriented programming: 1- Object \n 2- Class \n 3- Abstraction \n 4- Polymorphism \n 5- Inheritance \n 6- Encapsulation \n 7- Overloading & OverRiding "
};
int i;
private void showContent()
{
Grid ContentPanel = new Grid();
ContentPanel.Height = 400;
ContentPanel.Width = 440;
ContentPanel.Margin = new Thickness(0, 20, 0, 0);
scroll.Height = 400;
scroll.Width = 440;
scroll.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
scroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
TextBlock text_question = new TextBlock();
text_question.Height = Double.NaN;
text_question.Width = 420;
// text_question.Text = "Arsal Are you going.? If user is not login then there at detail page user want to add product in his wish list then there is popup comes .... Please Login There should be align text. when user goes to detail screen then first show batch 42 % off after that shows 0% off. more share button and like button alignment also changes slowly. user can identify easily.";
text_question.TextWrapping = TextWrapping.Wrap;
text_question.Margin = new Thickness(10, 10, 10, 10);
scroll.Content = questions[0];
ContentPanel.Children.Add(scroll);
//scroll.Content = questions[i];
TitlePanel.Children.Add(ContentPanel);
}
text_question.Text = ""입니다; 이 함수에서 주석 처리 된 것은 public 문자열이 줄 바꾸기를하지 않는 동안 줄 바꿈입니다.
문자열을 외부에 사용하려면 문자열을 공개해야합니다.
private void next_click(object sender, RoutedEventArgs e)
{
// MessageBox.Show("Here is Next Question");
a = a + 1;
count.Text = a.ToString();
if (a > 1)
{
previous.IsEnabled = true;
}
if (a == 5)
{
next.IsEnabled = false;
}
if (i >= 0 && i < questions.Length)
{
i = i + 1;
scroll.Content = questions[i];
}
}