fbコメントレイアウトのようなものを実行したいと思います。
そして、私はこのタスクを実行するために次のコードを使用しています:
// コンストラクター
string []content;
public MainPage()
{
InitializeComponent();
content = new string[11] { "Great stories produce the ideas which help children to know how the cleverness and wise decisions take the people out of the dangerous and most tricky situations.",
"No virtue is as noble as kindness. The stories “Prince Frog”, “Dove and the ant” and others teaches them the importance of being kind to even to the small god made creatures of this earth.",
"Honesty is a key to success and honest people are duly rewarded. These stories show honesty is a most beautiful quality to be possessed, liked and appreciated.",
"Humbleness makes us kind hearted and soft spoken- the virtues which will always be deemed and valued in the eyes of the others.",
"Realize the importance of hard work through these evergreen stories. These popular stories are the inroads to the very roots of the concept “Hard work is a road to success.",
"If you speak the truth, your children will speak too. This would help them built the trust and reputation in their society and around them.",
"Courageous child can easily cross each milestones of life with ease, then why not we too help our children to be strong for the others too to follow.",
"True Friendship is a God’s precious gift and a commitment for togetherness, and sharing and caring.",
"Understand the value of being united, to overcome any difficult situation and understand the meaning of working in a team and grow as a virtuous and a strong human being.",
"Obeying the elders will ultimately be good for you. Stories like \"Three goats and the Wolf\" can help your children understand the value of being obedient.",
"Greediness leads to destruction. It causes obsession which is more harmful. Let us know how through these great stories." };
populate_list();
}
private void populate_list()
{
for (int i = 0; i < content.Length; i++)
{
//mainlist.Items.Add(content[i]);
var maintext = new TextBlock();
maintext.Text = content[i];
maintext.TextWrapping = TextWrapping.Wrap;
StackPanel stkpanel = new StackPanel();
stkpanel.Width = 480;
stkpanel.Height = 124;
stkpanel.Children.Add(maintext);
var expander = new ExpanderView();
var phonetextbox = new PhoneTextBox();
phonetextbox.Hint = "Add a Comment";
phonetextbox.ActionIcon = new System.Windows.Media.Imaging.BitmapImage(new Uri("/search.png", UriKind.RelativeOrAbsolute));
StackPanel stkpanel_new = new StackPanel();
stkpanel_new.Width = 480;
phonetextbox.ActionIconTapped += (s, e) =>
{
if (!string.IsNullOrEmpty(phonetextbox.Text))
{
expander.Items.Add(phonetextbox.Text);
expander.IsExpanded = true;
//stkpanel_new.Height = stkpanel_new.Height + 20;
}
};
stkpanel_new.Children.Add(phonetextbox);
stkpanel_new.Children.Add(expander);
mainlist.Items.Add(stkpanel);
mainlist.Items.Add(stkpanel_new);
}
}
しかし、ユーザーがphonetextboxにテキストを入力し、リストボックスの2番目の要素の後ろに追加されたばかりのコメントのアイコンを押すと、動的コメントの挿入で問題が発生しました(ExpanderViewは展開されますが、リストボックスのそれ以上の要素は動的に調整されません)。
私は何か間違ったことをしていますか、それともフレームワークの制限ですか?? ヘルプ 。
よろしく
パーディープ・シャルマ