- gban: Ingyen kellene, de tegnapra
- Luck Dragon: Asszociációs játék. :)
- sziku69: Szólánc.
- Austin F.: Intel Iris Xe driver frissítés
- Klímaváltozás, természetszennyezés
- sziku69: Fűzzük össze a szavakat :)
- eBay-es kütyük kis pénzért
- MasterDeeJay: Natív 3Dfx Glide Windows11 alatt Voodoo1 és Voodoo2-vel.
- Gurulunk, WAZE?!
- Elektromos rásegítésű kerékpárok
Új hozzászólás Aktív témák
-
trisztan94
őstag
Egy ténylegesen C# kérdés most:
XAML-ben a definiált GRID ahogyan észrevettem egyáltalán nem úgy működik, mint a Windows Forms-os.
3 sorban van összesen 12 gomb, random gomboknak szeretném a Content attribútumát változtatni, de sehogyan sem tudok rá hivatkozni..
<Grid x:Name="buttons_container" HorizontalAlignment="Center" VerticalAlignment="Bottom">
<Grid.RowDefinitions>
<RowDefinition Height="70"/>
<RowDefinition Height="70"/>
<RowDefinition Height="70"/>
</Grid.RowDefinitions>
<Grid x:Name="buttons_first_row" Grid.Row="0" Width="600">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
</Grid.ColumnDefinitions>
<Button HorizontalAlignment="Center" Grid.Column="0" Content="" Foreground="White" Height="auto" Width="150" />
<Button HorizontalAlignment="Center" Grid.Column="1" Content="" Foreground="White" Height="auto" Width="150" />
<Button HorizontalAlignment="Center" Grid.Column="2" Content="" Foreground="White" Height="auto" Width="150" />
<Button HorizontalAlignment="Center" Grid.Column="4" Content="" Foreground="White" Height="auto" Width="150" />
</Grid>
<Grid x:Name="buttons_second_row" Grid.Row="1" Width="600">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
</Grid.ColumnDefinitions>
<Button HorizontalAlignment="Center" Grid.Column="0" Content="" Foreground="White" Height="auto" Width="150" />
<Button HorizontalAlignment="Center" Grid.Column="1" Content="" Foreground="White" Height="auto" Width="150" />
<Button HorizontalAlignment="Center" Grid.Column="2" Content="" Foreground="White" Height="auto" Width="150" />
<Button HorizontalAlignment="Center" Grid.Column="4" Content="" Foreground="White" Height="auto" Width="150" />
</Grid>
<Grid x:Name="buttons_third_row" Grid.Row="2" Width="600">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
</Grid.ColumnDefinitions>
<Button HorizontalAlignment="Center" Grid.Column="0" Content="" Foreground="White" Height="auto" Width="150" />
<Button HorizontalAlignment="Center" Grid.Column="1" Content="" Foreground="White" Height="auto" Width="150" />
<Button HorizontalAlignment="Center" Grid.Column="2" Content="" Foreground="White" Height="auto" Width="150" />
<Button HorizontalAlignment="Center" Grid.Column="4" Content="" Foreground="White" Height="auto" Width="150" />
</Grid>
</Grid>InterfaceDesigner-en próálható.
Tehát az a lényeg, hogy két random számom van: x és y. Az x az oszlopokat, az y a sorokat jelöli.
Ha pl. a 3-mat dob ki, akkor a 3. sor x. elemét szeretném módosítani.
Próbáltam így C#-ban:
buttons_first_row.Children.ElementAt(2)...ez szépen meg is találja a nekem kellő button-t (jelen esetben az első sor 3.), de módosítani sehogy sem tudom, ugyanis nincs .Content tulajdonsága a System.Windows.UIElement-nek.
Hogyan tudnám ezt szépen megoldani? Adjak minden gombnak egyedi nevet, aztán egy baromi nagy switch elágazással jelöljem ki őket?
Új hozzászólás Aktív témák
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- MO-RA3 4x180 Lt White radiátor eladó
- Macbook M1 Pro 8GB RAM 256GB SSD
- Eladó Vagy Csere Samsung Galaxy Z Fold 4
- EVGA SuperNOVA 750W GT 80 Plus Gold full moduláris tápegység / 53 hónap Alza.hu garancia
- Surface Laptop 4 Touch 13.5 Retina Ryzen7 4980U 4.4Ghz 16GB 512GB Radeon RX Vega8 Win11 Pro Garancia
- Telefon felvásárlás!! Xiaomi Redmi 9, Xiaomi Redmi 9AT, Xiaomi Redmi 10, Xiaomi Redmi 10 2022
- BESZÁMÍTÁS! ASUS H87I-PLUS H87 chipset alaplap garanciával hibátlan működéssel
- Lenovo Thinkpad L14 Gen 4 -14"FHD IPS - i5-1335U - 8GB - 256GB - Win11 - 2 év garancia - MAGYAR
- Samsung Galaxy Xcover 6 Pro, 6/128 GB, Kártyafüggetlen
- ÁRGARANCIA!Épített KomPhone Ryzen 5 4500 16/32/64GB RAM RX 6600 8GB GAMER PC termékbeszámítással
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest