I have window which is now movable in the application but the issue is the window get move out of the context as well with in the context it get go behind the control and than the window is not reachable.
Please suggest the solution for it.
Thank you
I am not sure this is what you are looking for, but you can try using FloatableWindow instead. If you want to know how it works, the source code is public and I am sure you can find the answer looking through it. I can say that it is normally pretty complex to get this working right with window resizing and all the other things you need to think about.
Related
I have been trying to move data from one WPF window to another while both are open without making a new instance.
This feels like it should be really easy but after hours of researching I cant get anything to work.
Here is what I have tried so far. This works, however, it creates another mainform.
Dim mainform As New MainWindow
mainform.TextBox3.Text = TextBox1.Text
mainform.Show()
if I try this without the word new it gives me an error.
I am totally puzzled by this.
Use MVVM pattern. Your ViewModel will contain all data that you need to be copied to the other window. Your Window class will have a constructor that accepts a ViewModel. Now just write a copy constructor for your ViewModel, create a new Window with that copy, and you're done.
I suggest you take a look at the MVVM concept, which will give you a great foundation for understanding how to setup your WPF application. It appears that you lack the basic understanding of WPF components necessary to achieve proper results. While there are many ways of developing WPF application, MVVM will provide that necessary base. Moreover, I suggest looking at MSDN and other websites that would provide beginner tutorials. By reading your question, I feel that you're trying to do something without really know what you're doing. I don't suggest that it's a bad thing in any way - I believe that the best way to learn is by doing, but you need to acquire some guidance in a manner of tutorials or perhaps a book.
I'm not sure that's the right way to say it, but what I want is to for my wpf main window to have it's own bar that will behave like a taskbar, and any children windows that will be open from the main one will be placed in that bar in a similar way like the taskbar works in windows - a rectangle showing the window name for example, on click it opens you the window, if you click minimize it will minimize it to the bar, and with some option, to get it out of the main window and move it to the real windows taskbar, with another option for putting it back in. The problem is I don't know if this is even possible, and I don't know the name of such an element, so if anyone can give me any tips I'll be really thankful.
I worked on an application years ago (.NET 3.0: first WPF release!) that did exactly that. We ran into a lot of issues getting it to work, but we were pretty successful in the end. One thing we didn't support was moving it to the Windows taskbar.
The best option would be to set an attached property on each Window. This would register a Window with your custom taskbar, so if you wanted to move the Window out of your custom bar, you'd set the property to false. Setting the property to true would add it to the collection of application windows, as well as register event handlers to track the state of the Window.
One of the major pain points for us was getting the Window animations correct. If you're not running in XP, this probably less of an issue, as the animations in Vista (or is it 7?) and above aren't really showing where a Window is going on minimize. In the end, we had to do a lot of low level Win32 (p/Invoke) work for this.
Take a look at AvalonDock and WPF MDI:
http://avalondock.codeplex.com/
http://wpfmdi.codeplex.com/
I'm looking for a way to draw an overlay. I want to create a small popup box in the bottom right corner to notify the user. I'm not sure what they are called, but I guess it's kinda like an overlay? I guess the easiest way to do this for me is in the winapi, but I'm not sure how. Anyone has a link I can read with more info, or maybe even code samples? Even the name of these notifications boxes would help so I can google better.
Thanks
don't know if it might help but you can try with sprite layers
http://msdn.microsoft.com/en-us/library/bb194908.aspx
I think these notifications are simply small windows with the WS_EX_TOPMOST style and an effect such as those provided by AnimateWindow().
Or if you don't want to do that much customization, maybe you can settle for a balloon tip from classic notification icons.
I am working on a WPF-MVVM (.Net 4.0) application that has a Metro look (it just has a look, it is not a metro application.)
I need to show a windows 8 like message box that blocks the operations for the user before he rids that message box by clicking yes/no/cancel (or any button.).
I came across this otherwise great article and momentarily thought that I have found the solution. But this has its own drawback.It just stops the user from interacting with the controls behind by mouse clicks. The user can however use the tab key to get back to the buttons behind and click them (pressing enter).
A number of things are coming to my mind:
should I go for custom adorners and play with hitTestable property?
Or should I place a control and play with its visible property.
Before going for any approach I thought of putting forward my question to the wonderful community here if someone has done a similar thing in past and provide me some pointer/reference/approach.
Can someone suggest what is the way to achieve this? Please note I will be happy to use prism or any other open source if that solves the purpose but the window will have to be custom made.
Please excuse me if you find this too stupid a question. Please pardon my ignorance. Thanks for reading this.
I recently came across a similar problem, I resolved it using a DialogPresenter as explained there:
http://www.codeproject.com/Articles/36516/WPF-Modal-Dialog
I had to do a few tweaks there and there but overall it's working fine and I now have a nice way to display dialog boxes!
There is a better way of doing it
var dialog = new MessageDialog("Select Social network is already authorised!");
dialog.ShowAsync();
Sorry for the noob question.... but
I have a rather large unilingual application that I have to make multilingual, meaning no resource file. I don't have the option of using the culture information but need to do it more on the fly at runtime so that the user can change languages either on startup or menu pick while in the application. I can handle that part ok. I realise there are traditional ways to set these values but I'm hoping to find a better solution.
What I'd like to be able to do is the following
First of all is this even possible? I've taken a pretty good look around and didn't really find anything close to what I'd like to do. I would even be willing create a few user controls if that was the solution. In the end I'll have to do this for buttons, labels, datagrid headers and messages(these are easy lol)
Any thoughts would be appreciated.
Thanks
Yes it is possible. Try this article: Creating an Internationalized Wizard in WPF.
Specifically look at the startup code for the application where CurrentCulture is modified for the CurrentThread.
Do not feel locked out of using per-culture resources by WPF. Different resources can be used via the "PublicResXFileCodeGenerator" as described in the article.
The MSDN Docs - CultureInfo.CurrentCulture Property may help.