I'm new to winForms, I'm trying just to create a simple SplitPanel.
I just drag it from the tools.
The problem is that if I move the mouse over the panel, the cursor shows the "split cursor", even if it is not over the split divise or even if I add some controls inside it.
I can't figure why and can't find nothing related to this (I don't attached a printscreen cause it hides the mouse and the problem is simple to explain)
Can this be a framework problem?
Related
I was not able to find an answer to a simple question like this...
I'd like to resize a XAML control using keyboard, like I did in Windows Forms.
Example: in Windows Forms when I placed a TextBox in a form, I could resize it using [SHIFT]+[LeftArrow] or [SHIFT]+[RightArrow].
In this way I was able to resize that TextBox with a high degree of precision, without using the mouse.
If I do the same using XAML, the TextBox is being MOVED, not RESIZED.
I tried many keyboards combinations, but I was not able to find the equivalent of [SHIFT]+[LeftArrow] or [SHIFT]+[RightArrow] for XAML controls.
Do you know if such a shortcut exists?
Sorry if it seems a dumb question, but I'm missing this feature.
Not exactly an answer to my question, but I found very useful using Ctrl+MouseWheel: is a fast method to zoom the design part so that using the mouse becomes useful again when you REALLY need to be precise in resizing controls (like in a canvas container).
Make them big and resizing using mouse is easy and precise to the degree you wish (6400% is enough for everything, I think :-) )
Hit Ctrl+0 to go back to "Fit all" selection
I'm making a custom dropdown button (since the one included in wpf requires too much hacking to style right). Now that i got the button bit out of the way i need to add the drop down part.
My first thought was to add a stackpanel and use that to contain the items but it gets cut off if it leaves the borders of the grid that the button is in. Next up was the popup primitive, it gets on top of everything nicely enough but position wise it just free floats and i haven't figured out how to make it follow the button it was spawned by. I also tried using contextmenu but that seems to have no positioning controls at all and just sits where the mouse made it..
Anyways wpf is a big package and I'm just getting into it, anybody know which direction i might find what I'm looking for?
Preferred approach normally is to use a Popup. You got two very important properties with a Popup
PlacementTarget and Placement
Setup a binding for PlacementTarget on the Popup to your custom Button and then use Placement to position the Popup accordingly w.r.t to the PlacementTarget(Button)
Placement accepts an enum of type PlacementMode which gives you quite a few options to position the Popup.
I have a window with a popup that pops when an item in a listview is double clicked.
It centers to the main window and looks really nice floating there.
The problem is when the user moves the main window or selects another program, and the popup floats on top of other stuff.
I would like to have something like a popup, meaning that it floats on top of other elements in the window, but sticks with the main window when it moves (stays centered), and doesn't float on top of other programs.
Can I make a popup act like this, or is there a better way to do it?
Popups will not move while the window is resized or moved. Because, Popups/Context menus are not the part of Visual Tree. You have to use Adorner for this. I will suggest to read this four part series for a quick start on Adorner.
It's possible that an Adorner will fit your needs in this case better than a popup. Adorners can float above your window, too. There are a few differences, mainly that an adorner is bound to a UIElement (which include windows).
If you are willing to use a third-party/open source (MS-PL) option, the Extended WPF Toolkit has a ChildWindow control.
It's technically not a separate window, but it appears to be a separate window to the user.
I have not found a way to make Popups stop doing that in WPF
As an alternative, you can create a UserControl which acts like a Popup.
Usually I host the content section of the app along with the Popup within a Canvas control, and when IsPopupOpen gets changed to True I set the popup Visibility = Visible.
I am using resources with Win32 to create a dialog containing a single tab control. The tab works fine when changing tabs but somehow dragging the window off screen ( eg. dragging it past bottom of screen then back up ) will cause the tab contents to disappear. I think it may be a problem with how I've set the clipping properties but after much fiddling I still didn't get it working exactly how I expect.
I have uploaded a basic skeleton project here which has the bare minimum required to reproduce this problem and would be very grateful if someone could check it out.
http://localhostr.com/file/nPTbTTQ/skeleton.rar
It is a Z-order problem, the dialog is behind the tab control. Change the parent of the inner dialog from hwndDlg to hwndTab. I don't want to guess why you saw the static control text at all.
i am trying to create a wpf app and have different parts in user controls.
in the navigation i have some buttons (now using the ribbon ctp). is it possible to change the main user control when different buttons are pressed in xaml. or is this just a bad way to do things?
sorry, really new to xaml and im trying to get my head arround it.
Further to what Carlo has said,
The way we do it is to have a blank grid in the place you want your controls to all appear and then use BlankGrid.Children.Clear() and BlankGrid.Children.Add() to set up which control is visible in this position.
We found that was the nicest programatically as we have a large number of custom controls, but Carlo's method would work nicely if you wanted to use the designer.
I think this is a pretty regular procedure in WPF. In my experience, me and other programmers put the controls where we want to show them and make their visibility hidden, collapsed or visible depending on what we want to show the user.