XAML Disabling Events on Child Elements when moving Parent - wpf

I have an ItemsControl that Contains a few buttons, My Items control is movable, you can move it around by dragging it. the issue is when I click and drag my control to move it, and leave the mouse on top of a button inside the control, it fires the click event of the button which I dont' want/
So While I am moving the control around I want to disable any events on the child buttons, I used IsDisabled = true but that changes the appearance of the buttons too which I dont want.

you can set IsHitTestVisible property of button to false
IsHitTestVisible="False"

Related

WPF How to prevent interaction with controls in background when Popup is open

When I display a Popup all other controls in the background appears to be not active (i.e. when I hover over a button for example it does not change a style). When I click somewhere to dismiss the Popup and it just happens to be a button where I clicked, that button takes a hit. This is very confusing, because one would assume that they can click anywhere to dismiss the popup and not just the empty space.
How to prevent interaction with controls in background when Popup is open?
OR
How to make controls in background react to the mouse hover even when Popup is open (like ToolTip)?
Setting IsHitTestVisible either to true or false seems to have no effect.

Custom Tooltip (Popup) does not stay open when Ribbon Is Collapsed

I created a custom tooltip that stays open when the mouse hovers over a button by using a popup. My solution is here. You can see the following attachment that displays the popup working correctly. By the way, any mouse event will be triggered on the popup in this state, such as MouseEnter:
For simplicity, hovering a mouse over the popup will trigger the MouseEnter event:
<Popup MouseEnter="TT_Popup_Control_MouseEnter"></Popup>
The issue is when the Child Ribbon Buttons collapse. When I click on the collapsed Parent Ribbon Button to expand the Child Buttons, and hover over the Child Button, I get something like this:
Again for simplicity, hovering a mouse over the popup will no longer trigger the MouseEnter event:
<Popup MouseEnter="TT_Popup_Control_MouseEnter"></Popup>
So when I hover over the popup, the popup no longer stays open in this state. Since the popup mouse events are no longer triggered, I believe this is the issue, but I don't know why this is the issue. Did I discover a bug in the .NET framework? Or is there something I am missing here?

How to reload focus on form controls (dockPanels)

I have one Form with four dockPanels
dock_1
dock_2
dock_3
dock_4
I want to focus on specific dockPanel by changing theirs 'tabIndex'. For dockPanel which should be focused I set tabIndex on 0, rest of dockPanels' indexes I increase.
I need control it inside method to be able trigger changes when I need it. I can set it inside constructor and during form first initialization focus can be set correct but it's not what I need.
The problem is that I can't force realod focus on form so when I change tabIndexes nothing happened.
Do you know how to trigger:
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.UpdateFocusedControl()
It should reload focus inside the form but I'm not able to trigger it.
I tried solutions similar to: myForm.Select() but without any results.
Thanks
The TabIndex property is not applicable for dock panels.
Use the DockManager.ActivePanel property to get or set the currently active dock panel:
dockManager1.ActivePanel = dockPanel1;
The active dock panel is the one that has focus or contains a control that has focus.
When the active dock panel is changed the DockManager.ActivePanelChanged event is fired.

Buttons keeping their focus class after losing focus

I have some buttons in a bottom toolbar of a gridpanel that control adding, and removing records from the row-editing grid.
The handlers are pretty simple: "new" button creates an instance of the model, appends to the grid and then opens a row-editor on the new row; "edit" button just opens the selected row's row-editor; "remove" destroys the record from the store and refreshes the grid view.
For some reason these buttons don't lose the focus class that gives them a border when they have the focus. Here is a picture:
In the picture both the "New" button and the "Remove" button have the focus class, when I press the "Edit" button it also keeps the focus classes even after doing a complete row-edit operation and closing the row-editor.
I did find that when I mousedown on one of these permanently "focused" buttons and then mouseup away from it and then click something else the focus class goes away.
I know that I could put a blur handler for all button components in my respective controllers but I would have thought that this functionality was built in so I am asking to see if there is something I missed somewhere in the docs.
The classes that it won't let go of are these:
x-focus x-btn-focus x-btn-default-toolbar-small-focus
This is with ExtJS 4.1.0 in FF10 on Windows 7. But I did notice similar behavior in ExtJS 4.02 and 4.07, just haven't needed to handle it until now.
I found out what it was:
At some point in the handler chain for each of these buttons the button gets disabled. When a button is disabled in ExtJS it prevents the blur event from firing.
It was necessary to disable the buttons so the solution to simply add button.blur() in the handler was the correct way to do go about it.

Show Tooltip immediately after click

I've got a Tree with custom TreeViewItems. The TreeViewItems contains a CheckBox. When I click on a CheckBox the background logic decides whether the click was valid or not and if it was invalid a warning message should be shown.
I added a Tooltip to each TreeViewItem and set the visibility to Collapsed when doing declaration. The Tooltip should show the message but if I set it to Visible in the TvItems click event it doesn't appears immediately just after it gets the mouseOver event again. Its the same if I set the IsOpen property in the event.
How can I force the Tooltip to appear when I want in this case?
You can try to use the ToolTipService class to set the InitialShowDelay to 0. But i think this will also show the tooltip directly when you hover your mouse over the element.
Maybe you should reconsider this design, because i think what you want to do proves to be difficult in some circumstances or not usable.
If you want to do it on a mouse Click, i would use a attached behavior to hook the mouse click, and show the tooltip by hand, which can be accomplished by grabbing the ToolTip of your TreeViewItem and setting IsOpen to true.

Resources