I have seen many people being able to handle the events at design time. I have a dock panel, which when clicked expands to give a container panel where user can drop controls. I was wondering if i can get any help of how i can achieve this?
Yes, you can do that and this should give you a fairly good idea of how to achieve it.
Related
I am struggling to place my control above the touch keyboard.
Anyone has a thought of how to accomplish this?
Here is an example of the problem: http://screencast.com/t/kHqHy8PAq
I want to control to show above the keyboard.
Thanks.
Please take a look at this sample on github. It has the basic ways of connecting to the touch keyboard events and a basic decorator that can be used to shift controls in response to them. You can modify them or use the ideas as you see fit to best suit your application.
Googled around and couldn't find anything... essentially what I want to do is allow the user to click and drag data points around to new values on a line graph control. The built-in chart control is pretty robust, but as far as I can tell, there's no way to add this kind of interactivity (am I overlooking something?).
I figured it would be a pretty hefty task to do this on my own, so I wondered if anyone had stumbled across this before and made a custom control to do it.
If not, any guidance on where the best place to start would be for making a custom control to do this?
Womp... solved my own question, turns out I was just Googling the wrong things. Ended up implementing a version of this:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/2bc4823c-1365-40ee-a239-b6f0c65a539a/datapoint-drawing-position-and-interactivity?forum=MSWinWebChart
It essentially uses the HitTest method of the built-in chart control to determine what point was clicked on MouseDown and just changes that point's X and Y on the fly in the MouseMove event. Pretty nifty.
I have an idea for a personal project. And I know one way of accomplishing it in Windows Forms (which I no longer wish to use). Basically I could (in WinForms) just draw everything onto the screen (Form) and then when I need to switch views/states of the application, just redraw the new stuff in the old stuff's place.
But how can we have different states in WPF? Is there a "right" or "proper" way of doing this? Is something like this covered somewhere in the docs?
I'd like to do my own searching, but I have no idea what exactly to look for, and current attempts at finding the right information, so far have yielded no helpful (or even relevant) results.
Any help at all will be greatly appreciated. I am new to WPF, but have been making a lot of progress this past week!
Thank you!
P.S.:
I just thouhght of something. If the solution was to draw what is needed for one screen, and when it is time to display the next screen, just dispose of/hide everything and create/display the new stuff, then how would we get around this? Because we can't/shouldn't change XAML markup at runtime, can/should we? :/
Not sure how you drawn your views/states in WinForms (direct painting on a Graphics object?).
The closest to what you're describing is the VisualStateManager. You can use it to statically define several visual states inside a single XAML and transit between them (using a smooth animation if you want).
If what you've done was show different Forms with Show/ShowDialog(), then the equivalent would be to use different Windows and Show/Hide them.
If you just cleared/added Controls to your form, then you can do just the same in WPF. Most Controls in WPF have a Content or Children property instead of Control.Controls in Forms.
I don't know if I understand what you really want. But here are my thoughts:
You can use several Windows and Show/Hide them accordingly
You can use the Frame/Page functionality in WP (MSDN)
if you really need to you could load your XAML and remove the topmost content in your Window and replace it with the loaded content
You could use the VisualStateGroup functionality to change the appearance of your current window
I think you will be happy with the second solution
I've been designing a pretty complicated avionics application. The thing is, it has many menu buttons to be clicked (12 to be exact) and each one of them perform a different action. For instance, one could be a login panel and the other one a PDF reader. How could I organize this programmatically?
Currently, I've been setting each item in a panel and setting it to visible or invisible, according to the active or clicked item.
How would you guys do this?
Thanks in advance!
You might consider a FlowLayoutPanel, although I'm not sure how flexible it would be in meeting your requirements. If you set your panels up with docking properties, you should be able to manage.
I would also recommend using a UserControl to separate code and functionality. If panels need to communicate, implement the observer/observable pattern instead of subscribing to events between user controls.
Like IAbstract says, you should consider separating the different UI elements as UserControls. You can then do things like use a factory to construct them and add them to your window as required.
I've found this sort of approach, used with a Model-View-Presenter type pattern, works really well for WinForms apps with dynamic user interfaces.
I have a form and want to set the initial focus to a text box. Is there a good way to do this with Silverlight and Caliburn.Micro? My first thought is to add an event that fires on page load and set the focus there. However, I suspect this will not be the way to do it because that would require finding the textbox. Is there a standard way to do this?
Caliburn.Micro doesn't specify any particular way to do this, but if you read this forum discussion http://caliburnmicro.codeplex.com/Thread/View.aspx?ThreadId=222892 you will get some insight. I think the FocusBehavior at the bottom may be what you are looking for.