Adding programmatically a control on top of others - vb.net

I'm looking for adding a control on top of others controls during runtime.
I read that the only way of playing with the Z-Order of controls is by playing with the order of the controls inside the Form.Controls Collection. I find this solution very weird and weak and I'm looking for an alternative.
Does anyone has an idea? I just want to make some kind of modal dialog that'll show below another user control to notice the user that the user control is currently doing something.
Edit: I tried using Control.BringToFront() but it doesn't work at all.
Thanks a lot!

You're looking for the BringToFront() method.

Related

xaml automatic align of a textbox inside a RelativePanel

I have a TextBox inside a RelativePanel in a universal Win App in C# (XAML/vs2015).
I want the textbox to be always on the right end of the panel, even when the form size changes.
Please tell me how to do that
thank you
Well since the generic answer did the trick without needing any further detail, might as well enter it as an answer so other viewers know you got sorted and skip the question.
Since it's a child of the RelativePanel you need to supply the declaration to the element, in this case TextBox using the bool property set to true of;
RelativePanel.AlignRightWithPanel="True"
Glad you got a remedy, have a great weekend!

Embed CommandBar into Form

I'm not sure if this is at all possible, but I'd like to be able to 'embed' a CommandBar into an Access 2003 Form.
I'd like to do this because the nature of my application is such that its forms are 'floating' so it doesn't look like it was developed in Access.
I know I can put Command Buttons on the form, which would achieve something similar, but I'd like a way to differentiate between the two types of buttons.
I'll be using it (if it's possible) to have a help menu present on some Forms.
Any ideas would be greatly appriciated!
I managed to achieve a similar effect by placing labels of a different color at the top of the form, then assign custom context menus to appear on left click. This is similar to the code found here:
How to add a menu item to the default right click context menu

AutomationPeer - how to show data of elements not on the control?

I want to write an AutomationPeer for my custom control in WPF.
Now, I want to show textBlocks \ TextBoxex that are not actually visible on my control.
I know how to override the method GetChildrenCore().
My problem is that when i run the playback (coded ui record) - it's trying to find a control not vissible on the window. Have you got any ideas?
You can set the SearchConfiguration VisibleOnly on the Coded UI control. Also, the UITestControl.FindMatchingControls method can let you know if the search properties are too ambiguous. Coded UI stops looking for a control after the first instance of a matching control is found.
inspect.exe can shed light on a form and how Coded UI may be seeing the control.
Try opening the Designer.cs and see the hierarchy and what Coded UI is trying to find.

How to stop my tools strip menu items from appearing in the taskbar?

I have a program which runs mainly though a NotifyIcon in the bottum right of my windows screen (XP). Whenever I open the ContextMenuStrip that appears when the icon is right clicked, a box also appears in the task bar. I also have nested menus inside the menu (mouse over one item leads to another menu), and each additional menu also creates a taskbar box upon appearing. So once I am at the third or fourth nested menu, there would be 3 or 4 windows appearing in the taskbar. After the menu disapears, so do the windows in the taskbar.
How can I stop the taskbar from displaying boxes to represent these menus? I have done nothing in my code as far as I know to create this type of behavior. I have searched for similar problems but have found nothing similar. There is no "showintaskbar" property for these items as far as I can see, and no other property that I can find which would affect this. I have investigated the owner of the contextmenustrip since I read the owner may effect these type of behaviors, but that doesnt seem to be helpful as there isn't an owner property of the contextmenustrip.
I don't know what else to search for, so I am here hoping someone can give me a clue as to what else may effect this type of behavior.
Any help is greatly appreciated. Thank you!
If you are using the ContextMenuStrip.Show() method, it will display in the taskbar as you describe. Try assigning your menu to the NotifyIcon.ContextMenuStrip property instead.

Silverlight DataGrid selection and drag-drop

I am currently implementing drag and drop using the DataGrid provided in the Silverlight SDK and I want the user to be, easily, able to drag multiple items to another list.
The grid's selection gets updated on the MouseDown event so the only way the user have to drag multiple items is to press Shift while begining the drag operation. This is not really obvious and, for me, the natural way whould have been to just click the selected block of rows and drag them. To do so, the selection needs to be updated on the MouseUp event.
I've tried to derive from the DataGrid to inject my custom DataGridRows but the DataGrid doesn't expose a way to replace the type of rows it creates.
Anyone have a solution or ideas for this?
Thank you,
Jacques.
Yes, it's unfortunate that the selection is updated on mousedown. You will need to perform some work in the mousedown event to work around this. This codeproject article should help:
http://www.codeproject.com/Tips/338594/Drag-drop-multiple-selected-rows-of-datagridview-w