Check alle échte Black Friday-deals Ook zo moe van nepaanbiedingen? Wij laten alleen échte deals zien

[WPF] TabIndex pakt niet.

Pagina: 1
Acties:

  • Snake
  • Registratie: Juli 2005
  • Laatst online: 07-03-2024

Snake

Los Angeles, CA, USA

Topicstarter
Hi ;)

Ik heb een venstertje voor in te loggen.

Dit is de code:
XML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    x:Class="Login"
    Title="Login" Height="240" Width="360" 
    ResizeMode="NoResize" 
    x:Name="login" 
    FocusManager.FocusedElement="{Binding ElementName=textBoxUserId}" 
    WindowStartupLocation="CenterScreen"  
    MinHeight="240" MinWidth="360" 
    mc:Ignorable="d">
    <Grid x:Name="mainGrid">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Label Margin="15,0,0,0" FontSize="16" VerticalAlignment="Top" Content="Gebruikersid:"/>
        <TextBox Height="30" Margin="8,0,8,10" VerticalAlignment="Bottom" FontSize="20" x:Name="textBoxUserId" Padding="0" TabIndex="1" Grid.ColumnSpan="2"/>
        <Label Margin="15,0,0,0" FontSize="16" VerticalAlignment="Top" Grid.Row="1" Content="Wachtwoord:"/>
        <PasswordBox TabIndex="2" Height="30" VerticalAlignment="Bottom" Margin="8,0,8,10" FontSize="20" x:Name="passwordBoxPassword" Grid.Row="1" Padding="0" Grid.ColumnSpan="2" Grid.RowSpan="1"/>
        <Button Click="ButtonLogin_Click" Margin="8,8,8,8" TabIndex="2" Grid.Column="1" x:Name="buttonLogin" FontSize="20" Content="Login" Grid.Row="3"/>
    </Grid>
</Window>

Het probleem is dat dit ding geen rekening houd met de TabIndex-en.

Zeer ambetant dus.

Ik heb natuurlijk zitten te zoeken, maar op Google kom ik NIETS maar dan ook NIETS tegen ivm TabIndex en WPF, hetzij met het focussen onload, wat niet het probleem is.

De Window start op met de focus op textboxUserID. En dan zou hij met TAB door moeten gaan naar hetvolgende. Which he doesn't.

Ik mis de magic key. Wie heeft 'm voor mij :$

Going for adventure, lots of sun and a convertible! | GMT-8


  • beany
  • Registratie: Juni 2001
  • Nu online

beany

Meeheheheheh

Je passwordbox en je button hebben allebei TabIndex 2.

Geef textBoxUserId TabIndex 0, je button 1 en je passwordbox 2. Je zal zien dat hij dan de volgorde textBoxUserId, button, passwordbox aanhoud. Tenminste, bij mij wel :)

Maar ik neem aan dat je een andere volgorde wil. Dus, textBoxUserId 0, passwordbox 1, je button 2.

Kortom: tabindex doet het prima, zolang je maar niet controls dezelfde index gaat geven...

[ Voor 30% gewijzigd door beany op 06-05-2008 16:49 ]

Dagelijkse stats bronnen: https://x.com/GeneralStaffUA en https://www.facebook.com/GeneralStaff.ua


  • Snake
  • Registratie: Juli 2005
  • Laatst online: 07-03-2024

Snake

Los Angeles, CA, USA

Topicstarter
beany schreef op dinsdag 06 mei 2008 @ 16:48:
Je passwordbox en je button hebben allebei TabIndex 2.

Geef textBoxUserId TabIndex 0, je button 1 en je passwordbox 2. Je zal zien dat hij dan de volgorde textBoxUserId, button, passwordbox aanhoud. Tenminste, bij mij wel :)

Maar ik neem aan dat je een andere volgorde wil. Dus, textBoxUserId 0, passwordbox 1, je button 2.

Kortom: tabindex doet het prima, zolang je maar niet controls dezelfde index gaat geven...
Probleem gevonden...

Ik vang de toetsen af van de eerste textbox (hij mag alleen numeriek accepteren).

Even
C#:
1
Key.Tab
toelaten ;)

Thx m8

Going for adventure, lots of sun and a convertible! | GMT-8