English 中文(简体)
视窗电话 7 ListBox指数操作员
原标题:Windows Phone 7 ListBox index operator

我正试图在Windows 7.的银星号中添加“强硬”。 我想这些插图出现在固定的宽度栏目中,而名单Box则在名单Box开始新行时想进。 此外,在用户点击纽子时,在名单Box中增加一个字。 我尝试使用瓦解弹片,但是这并不允许 view。 现在,我的目前解决办法是有效的,但指数操作者给我一个指数,以排除约束错误,而插入方法使我重复下行的条目......

我试图使用插入方法或指数操作者(显然不是两者兼有)一样:

this.wordListBox.Items.Insert(numRows, formatRow);
this.wordListBox.Items[numRows] = formatRow;

This is an idea of the flow of my program, Example: The user clicks a button and a Word is concatenated to the presently null formatRow and formatRow is added to the wordListBox at numRows which is presently 0. The button is clicked again and another word is concatenated to formatRow and formatRow is added to the wordListBox at numRows which is still 0. Thus, I now have the first element of wordListBox set to a string that contains two words. This repeats until 5 words have been added to formatRow and then, numRows is incremented and formatRow is set to null. Now, words will be added to the next row in the wordListBox, and the wordListBox will scroll into view because each element of the ListBox will be one string.

Can anyone point out my error with the insert method of index operator or show me how to make these functions work for my purposes? Also, If anyone needs a better explanation I will try my best to explain in more detail.

最佳回答

I would say you could try to use an ObservableCollection to hold your items and then bind this to your Listbox-es ItemsSource, but directly adding to the Items collection works too. And to set focus on an item try the Focus method of the ListBoxItem.

最低生活水平

水电部、APRESS、MS for WP7开发有几本大书。

WP7的公用钥匙

31 Day Mango

WROX WP7 books

问题回答

暂无回答




相关问题
Silverlight Rich text box control

Our team decided that we need our own custom Rich text box control for Silverlight app we are developing. We looked at existing controls mentioned at A good rich text control for Silverlight but ...

Silverlight ImageBrush not rendering (with Bing Map Control)

I m trying to add an image to a Pushpin instance from the Silverlight Bing Map Control, but I can t seem to get it to render (the pushpin renders fine). This is probably a general WPF question rather ...

Silverlight OpenFileDialog DoEvents equivalent

I m processing large files after they are selected by the user. My code looks like the following: if (FileDialog.ShowDialog() == true) { // process really big file } This freezes up the UI so ...

list of controls with templates in silverlight

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I ve wasted several hours now trying to create control templates only to find that the control doesn ...

Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Silverlight 3 - FindName returns null

This looks a bug to me.. Using Silverlight 3 and i have a user control defined in XAML and trying to access the object during runtime returns a null. <Grid> <common:CommonGridEditPanel x:...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...

热门标签