Pass clicks to parent views - c#

I have a TextBlock on top of other views with low opacity, How ever this is eating the click events (as well as mouse hovering events) and does not let underneath views to recieve click events.
How do I avoid this in UWP with or without caliburn micro?
Similar problem but this is for winforms, Also I only want this effect for a single view not entire window.
I have tried PointerEntered, Tapped, Holding events to set their handled parameter to true or false but none of that worked.

I just had to set IsHitTestVisible to false :|

Related

How to block a window as if Dialog window was displayed

I have a form which I would like to block during execution of an async event. I would like to achieve an effect similar to when a dialog window is displayed, without displaying or creating one.
I don't want to manually disable controls on the form, as some controls may be added in the future (not necessarily by me). I would like to avoid disabling the entire form / user control for aesthetic reasons.
Is there a standard/elegant way of achieving this, or am I going in a wrong direction?
You can block WinForm window by setting it's Enabled property to false, but it will prevent user from any action with that window (like moving, resizing or hiding) and it may be very annoying. Consider showing some load indicator instead.
I would not recommend to disable controls without making them look disabled because it could confuse user.
Edit: As #AvoNappo pointed out window behavior differs depend on where to set Enable property to false:
if you set it in the constructor user still will be able to move/minimize/close window;
if you call it after constructor window control buttons and windows movement also will be blocked.

In C# WPF window, adding button for topmost beside standard window buttons

I'd like add a button for changing window state to topmost to the built-in window buttons such as maximize, minimize, and close [please refer to this pic.]
However, I'm having hard time finding the way out as WPF seems not to provide such an API. I even thought using the icon next to the window title functioning as the button for topmost, but looks not feasible.
Is there anyway like using .dll or could I inherit the window class and add the button and corresponding event handler anyhow?
Thanks.
It will be very difficult as you can see below link:
How to add an extra button to the window's title bar?
To make things easy, you should consider implementing a custom window for that. This window will have custom buttons including Close,Minimize,Maximize along with any other buttons as well.

UWP MenuFlyout in Application.Resources - how to assign events?

I'm relatively new to UWP, but I have good WPF background.
What I need is a simple context menu for the application. User "right taps" anywhere, menu opens, user taps an item and things happen.
It looks basic and simple. First I add MenuFlyout element to my Application.Resources. Then, in MainPage I just show it with ShowAt method. Works.
To my greatest surprise when I tried to add events to menu items, VS told me it's invalid, events cannot be added in App.xaml.
So here's my assignment (in App.xaml.cs):
MainContextMenu = (MenuFlyout)Resources["MainContextMenu"];
MainContextMenu.Items.First(i => i.Name == "NavToCalibration").Tapped += NavToCalibration_Tapped;
The problem is - the handler is never called. I run my app, open the menu, click on the item and nothing happens. The assigned method is not called. What am I doing wrong? Why the handler is not called?
The assignment IS executed on application launch.
I'm also surprised I haven't been able to find any example or tutorial on doing such a simple and basic thing.
There is a good reason I use app-wide context menu instead of other controls. The app displays test images, it has to be full-screen (or maximized window) without interfering elements.
Now I will try to move my menu to the page resources, my pages will have different context menus anyway. But I'm really curious what's wrong in MenuFlyout defined in App.xaml?
Whoa. I tried to move my MenuFlyout to MainPage. I was able to assign Tapped event in XAML. And it also is not triggered! Now I'm completely lost. Any ideas?

limiting tabbing to a custom in-window message box

I have made a custom MessageBox for my application and it launches as a UserControl. I have two buttons inside it and I would like to allow users to press Tab to switch between Buttons. However, since it's a UserControl overlaying the content, Pressing tab more than twice makes the focus go in the background on elements that aren't supposed to be tabbed at.
I can't figure out a good idea how to prevent this, I've thought of making a method that will select all elements and make their IsTabStop values to false and then restore them later, but I think that would be more of a problem then a solution.
Is there a way around this to limit tabbing only to the UserControl?
I would also appreciate advice on working with the message box.. the whole messagebox is an async function that has an infinitive loop until the answer is given. Is there another way to stop the application until one of the message box options was selected?
Crowcoder's reference has lead to correct MSDN page where I found my solution:
dialog = new UCMessageBox("Are you sure you want to exit the application?", MBType.YesNo);
AppMessageBox.Children.Add(dialog);
KeyboardNavigation.SetTabNavigation(dialog, KeyboardNavigationMode.Cycle);
The key was to call .SetTabNavigation function and direct it to my dialog (custom UserControl for the message box) and setting the KeyboardNavigationMode to Cycle.
After closing the UC rest of the application continued normally regarding navigation.

Tab Control tab will only use Wait Cursor

So, I'm making a game in C#, and I've created a window to handle custom controls schemes.
On this page there is a tab Control, with three tabs: Scheme 1, Scheme 2, and Custom
Scheme 1 and 2 are perfectly fine, but on the Custom tab, whenever the mouse hovers over it, it displays the wait cursor. The controls inside the tab work perfectly fine and without lag, but it just always displays the waitcursor.
I can't change the cursor property in the Design window (it just goes back to waitCursor), and I've tried changing it in code, but it won't work.
Please check the following property in your tab control and each tab:
UseWaitCursor set to true
If UseWaitCursor = true for a parent control then it will propagate this property to all child controls. I think this is probably your issue. Please see the link below for an explanation of the property:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.usewaitcursor.aspx

Categories

Resources