Skip to content

Expander header + TextBox #11101

@JanVanharaBP

Description

@JanVanharaBP

Describe the bug

I have expander and in header I have TextBox. When user writes into the textbox the expander on each space expands/hides content. Expander's template is button template and it reacts on space as Accelerator key - similarly as button does - and space is basically use the button command.

Why is this important?

I may be doing something wrong, but I tried few ways to work it out without luck. Its not nice to expande/hide expander's content on each space.

Steps to reproduce the bug

<Expander HorizontalAlignment="Stretch"
          HorizontalContentAlignment="Stretch"
          IsExpanded="{x:Bind ViewModel.Expanded, Mode=TwoWay}">
    <Expander.Header>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0"
                       Text="Name: "
                       VerticalAlignment="Center"/>
            <TextBox Grid.Column="1" 
                     Text="{x:Bind ViewModel.Name, Mode=TwoWay}"
                     Margin="10,0,10,0"/>
            <CheckBox Grid.Column="2"
                      Content="Enabled"
                      Padding="8,8,0,0"
                      IsChecked="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}"/>
            <Button Grid.Column="3"
                    Command="{x:Bind ViewModel.OpenPermissionsCommand, Mode=OneWay}"
                    Margin="0,0,5,0">
                <StackPanel Orientation="Horizontal">
                    <FontIcon Glyph="&#xE83D;"/>
                    <TextBlock Text=" Permissions"/>
                </StackPanel>
            </Button>
            <Button Grid.Column="4"
                    Style="{ThemeResource AccentButtonStyle}"
                    Background="{ThemeResource SystemFillColorCriticalBrush}"
                    Content="Delete" Margin="5,0,0,0"
                    Command="{x:Bind ViewModel.DeleteCommand, Mode=OneWay}"/>
        </Grid>
    </Expander.Header>
 <!-- Some content here -->
</Expander>

Now when you write in such expander, then it expands on space.

Actual behavior

No response

Expected behavior

When focus is on TextBox, underlying Expander header doesn't process it.

Screenshots

No response

NuGet package version

2.0.1

Windows version

Windows 10 (21H2): Build 19044

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageIssue needs to be triaged by the area owners

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions