How I can know when a control, in this case a DataGridView, which is included in a Windows Form, size is being resized by the user?. I wish I could tell when its size has changed from a method, or when a user has to resize the windows form. Is this possible?.
I only found DataGridView.SizeChanged event.
The solution was to control the event and there form SizeChanged save the position and size of the grid.
Related
I just wondering about my windows Application. When i re-size windows form that time my Form controls should re-size. Can any body tell me how to do this in Vc++
Each one of your controls has an anchor property, set this property on each control to their relative position on the form then when you resize the form the controls will move and stay "Aligned"
i hope this is what you are referring to, and that this helps
Is there a way to make an entire WPF Window inert after a button click?
The window is invoked via Window.ShowDialog() and after use, the window is no longer needed for interaction but I leave it open to remind the user of the inputs in TextBox's, ListBox's, and give visual feedback via OxyPlot and so on. I leave it to the user to close the window manually.
One solution is to disable all buttons but that's tedious and it still leaves TextBox's functioning. That's not optimal because for anything to be functioning creates the wrong impression that the Window remains for anything other than looking at. It would be better for every control to be non-functioning by a single setting.
I did it by putting a name on the WPF window code behind and then setting .IsEnabled false upon the appropriate button click. All buttons, combo boxes, text boxes, and even OxyPlot became inert at that point and most parts were greyed out.
Consider creating a dedicated boolean dependency property in your code-behind or viewmodel and binding IsEnabled of every TextBox to the property.
I created a user control in Silverlight, so now I can siply reuse it multiple times anywhere I want. This control also uses a popup. When the popup is opened, I programatically set its position so it looks like anchored to the control. But when this popup is already visible and user changes size of Internet Explorer window, the contens of page are moved and the popup is not moved. [Obviously.] So it doesn't look like anchored to the control anymore. How to fix it? Which event to handle?
I expect there is some event which is fired when user changes size of the window. Or even better an event which can inform me when the owning control is repositioned, so I know the new position of the control (which I need to know in order to compute the coordinates for the popup). Since I want it to work as a user control, I would prefer a local event on the control itself (i.e. without messing with any global page/window stuff). Please help me to find the right event.
Update: It seems to me now that LITERALLY I need to know when the owning control is moved. Because there can also be other reasons why it's moved (other than abovementioned change of the window's size).
I think you are looking for the SizeChanged event. You can subscribe to that to know when to resize your popup.
If your control is moved because of another control, this may not help though. As it may not resize, just be arranged in a new location.
If that's a problem, you can use the LayoutUpdated to determine if anything changed inside an element. For this you'd need to attach a handler to the RootVisual or something above your element.
If I create a ComboBox from scratch, when the window is resized, the content is correctly displayed above/below, etc.
Why this doesn't happen when you create your own Combo-derived class? What am I missing?
Controls aren't magical. They need to be told that things happen (call a method on them) or look for them to happen (register for an event).
Find your Application.RootVisual and register for a SizeChanged event. Then resize your control. If it is in browser you may need to create a javascript bridge (hopefully not) that tells your SL object when the browser resizes.
I have added a Canvas to the Grid then added my custom keypad on the canvas. Now on TextBox.GotFoucs event I changed Canvas.Visibilty = Visiblity.Visible;
But the issue is that when the TextBox gets focus it shows the default keypad in front and my Canvas behind it. I want the Canvas to be displayed on top of the default keypad and should work as a text entry control to the TextBox. How can I do this?
The display of the SIP is handled by the operating system and will always be on top of the visual tree of any application. If you want to provide a custom SIP, you will need to provide an alternative input control, because the display of the native SIP is tied to input controls (such as TextBox, PasswordBox, etc.). You may find this article about creating a Bulgarian keyboard useful.