Du ListboxItems altuera ListBox baten ezarpena programazioaren Windows App Store for

I’m working on a windows store application and one of the things I want to do in the app is display a log that shows status messages and other informational tidbits as the user works things. Horretarako, ListBox bat honakoa gehitu dut:

<ListBox x:Izena ="GameStateLog" HorizontalAlignment ="Zentroa" Altuera ="221" VerticalAlignment ="Top" Zabalera ="499" Betegarria ="0" FontSize ="10">

 

C # listbox kodea du populatu behar exekuzio at lerro batera izan zen:

GameStateLog.Items.Insert(0, GameStateCounter     + ": New joko egoera: Jokalari zain 1 izena");

This worked out fine enough but the UI showed a crazy amount of padding around the individual messages as they were added. Duten zentzua nahi dut bukaera erabiltzaileek elementu horiek hautatzeko, baina ez du zentzurik denean nahi dut log mezuak serie exekutatzen erakutsi behar izateko - erabiltzaileak ez hautatu horiek, just view them. Bitxia gogorra izan zen, oso erraz hau egin aurkitu, eta dudarik gabe,, the way I found it isn’t necessarily “easy” but I got it working OK. Gako ikuspegi honetan posting zetorren hemen (http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c4a6f694-bd46-4779-ab83-b1c2fcb2397c) from Bob Relyea. Horren ordez kateak gehitzen elementuak bilduman ListBox buruzko, add ListBoxItems. Kate bat gehituz, the ListBox was creating its own ListBoxItem on its own. I wasn’t able to affect anything about that ListBoxItem after the fact. Kode berria da:

        pribatua gal AddGameStateLogMessage(katea theMessage)
        {
            ListBoxItem = hori berria ListBoxItem();
            li.Content = theMessage;
            li.MaxHeight = 25;

            Lodiera = thisPadding berria Lodiera(5, 0, 5, 0);
            = thisPadding li.Padding;

            GameStateLog.Items.Insert(0,li);
        }

 

Here I’m creating ListBoxItem’s and inserting them. Gehiegizko betegarria kendu dut bere lodiera ezarriz.

Hau da, nahiko malgua da, ez dut nahi kolorea zenbait mezu mota bereziki nabarmendu nahi kodifikazioa egin eta zuzenean ListBoxItems gehituz estilo horiek inola dut nahi lortu dut.

Hope honetan laguntzen norbait!

</amaiera>

undefinedNire blog Harpidetu.

Follow me on Twitter http://www.twitter.com/pagalvin

Utzi iruzkin bat

Zure e-posta helbidea ez da argitaratuko. Beharrezko eremuak markatu dira *