- NVIDIA GeForce RTX 5070 / 5070 Ti (GB205 / 203)
- Videós, mozgóképes topik
- Milyen videókártyát?
- NVIDIA GeForce RTX 5080 / 5090 (GB203 / 202)
- VR topik (Oculus Rift, stb.)
- Milyen asztali (teljes vagy fél-) gépet vegyek?
- Apple MacBook
- Milyen billentyűzetet vegyek?
- Milyen processzort vegyek?
- Milyen notebookot vegyek?
Ú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!
- Futás, futópályák
- Padavan firmware
- iPhone topik
- PROHARDVER! feedback: bugok, problémák, ötletek
- NVIDIA GeForce RTX 5070 / 5070 Ti (GB205 / 203)
- Audi, Cupra, Seat, Skoda, Volkswagen topik
- Építő/felújító topik
- Videós, mozgóképes topik
- Milyen videókártyát?
- NVIDIA GeForce RTX 5080 / 5090 (GB203 / 202)
- További aktív témák...
- Samsung Galaxy A56 5G / 8/128GB / Kártyafüggetlen / 12Hó Garancia / Bontatlan
- MacBook Pro 13" M1 (2020) 8GB RAM / 256 GB SSD
- Samsung Galaxy A36 5G / 6/128GB / Kártyafüggetlen / 12Hó Garancia / Bontatlan
- Samsung Galaxy A16 / 4/128GB / Kártyafüggetlen / 12Hó garancia / Bontatlan
- ÚJ RAZER BLADE 18" QHD 240Hz / RTX 4090 / i9-13950HX / 32GB / 2TB NVMe! BeszámítOK
- Apple iPhone 11 Pro / 64GB / Kártyafüggetlen / 12Hó Garancia / 100% akku
- BESZÁMÍTÁS! Intel Core i7 6700K 4mag 8szál processzor garanciával hibátlan működéssel
- GYÖNYÖRŰ iPhone 11 128GB Black -1 ÉV GARANCIA - Kártyafüggetlen, MS3265, 100% Akkumulátor
- Dell Precision 5810 Intel E5-1650 v3 128GB RAM 2x512GBHDD 1x512GB SSD Quadro K4200
- HIBÁTLAN iPhone 13 Pro 256GB Silver -1 ÉV GARANCIA - Kártyafüggetlen, MS3381, 96% Akkumulátor
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: CAMERA-PRO Hungary Kft.
Város: Budapest