# HitTestMode on DockPanel and panels with 100% width

**URL:** <https://forums.fusetools.com/t/hittestmode-on-dockpanel-and-panels-with-100-width/6462>\
**Category:** How-to Discussions\
**Created:** [July 27, 2017, 1:50pm UTC](https://forums.fusetools.com/t/hittestmode-on-dockpanel-and-panels-with-100-width/6462 "2017-07-27T13:50:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nderitumaxwell](https://avatars.discourse-cdn.com/v4/letter/n/a88e57/32.png) [@nderitumaxwell](https://forums.fusetools.com/u/nderitumaxwell)\
**Post date:** [July 27, 2017, 1:50pm UTC](https://forums.fusetools.com/t/hittestmode-on-dockpanel-and-panels-with-100-width/6462/1 "2017-07-27T13:50:03Z")

</div>

Hello everyone. I had a question on HitTestMode works

```auto
<DockPanel Margin="5,10">
    <StackPanel Orientation="Vertical" Dock="Left"
        Clicked="{goToViewAccountPage}" Width="100%"
        HitTestMode="LocalVisualAndChildren">
        <Text FontSize="12" Value="Hello World"/>
        <Text FontSize="12" Value="Hello Programmer"/>
    </StackPanel>

    <Panel Alignment="Top" Text="EDIT" Dock="Right"
            HitTestMode="LocalBoundsAndChildren"
            Clicked="{goToEditAccountPage}" MinWidth="100" />
</DockPanel>

```

On the code snippet above I have a DockPanel which encloses two panels in it.

The first panel is a StackPanel which holds two text fields, once the this panel is clicked it should activate the goToViewAccountPage function.

The second panel is a button that should activate the goToEditAccountPage.

But what is happening when a click the second panel its activating goToViewAccountPage function.

Please help!!!

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [July 27, 2017, 2:14pm UTC](https://forums.fusetools.com/t/hittestmode-on-dockpanel-and-panels-with-100-width/6462/2 "2017-07-27T14:14:01Z")

</div>

We strongly recommend posting _complete_ reproductions, since testing little snippets of code without seeing **how you use them** is extremely ineffective and prone to missing important details. Without a _complete_ repro, you’re also limiting our ability to explain why things work in a particular way, when interacting with their parent containers etc.

That said, the problem in this case is that you’re not using `DockPanel` right (100% width on a child within one?). And it’s not even related to `HitTestMode`. Here’s something that _should_ work fine:

```auto
<DockPanel Margin="5,10">
    <Panel Dock="Right" HitTestMode="LocalBounds" Clicked="{goToEditAccountPage}" MinWidth="100" Color="#18f" />
    <StackPanel Orientation="Vertical" Clicked="{goToViewAccountPage}" HitTestMode="LocalVisualAndChildren">
        <Text FontSize="12" Value="Hello World"/>
        <Text FontSize="12" Value="Hello Programmer"/>
    </StackPanel>
</DockPanel>

```

Sadly, I don’t have the possibility to be fully certain that it works, because as explained above, I don’t see how you’re using it.

Hope this helps!
