I'm bulding an app in Winform using User Controls.
The problem is that when I update my user control (refering to the style) the forms where it is used don't realized that. If I add some code behind that works, but not the style.
This is the last version of one of my UC.
This is how it is shown in the form
The real problem is the space between the label and the textbox! I need to remove it.
I tried cleaning the bulding, updated the control panel, but nothing works.
Related
Scenario: I have one more more WPF applications opened. I cannot change the source code of these apps. My purpose is Whenever user clicks any control (button, combobox, textbox etc.) on these apps, I want to know which control / element is clicked, and log it. Simply obtaining the name of the element would be enough like so: "App1 - button3 is clicked." or "App2 - button1 is clicked". If possible, I want to achieve this for both Winforms and WPF apps, but WPF is more important.
Any way to do accomplish this in the background is OK.
I tried examining and using source codes of snoopwpf (Since it is able to detect the element under the mouse cursor by pressing CTRL+SHIFT), but I wasn't able to achieve my purpose. I could not get the elements in different AppDomains. (AppDomainHelper.GetAppDomains() also returns null)
I looked a little into pywinauto module, however couldn't find such a functionality.
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 have a WPF Winform application. The form has a header on the top and a user control below. Once i am done entering values in the user control, i want to dismiss this user control and add another user control in that area. I will have 4 user controls in a sequence and I may have to move back to the previous user control or move forward.
Which is the better approach to achieve this in MVVM? To hide and view the user controls or dispose the user control.
Hide. Its simpler.
Also your description sounds remarkably like a wizard, so you might want to look at using a NavigationFrame as this would then allow you to "navigate" to the next set of controls once once set is complete.
P.S. Navigation frames can very easily be styled to completely remove the navigation bar UI, see http://winchrome.codeplex.com/ for some examples
I started looking at wpf recently and am having a hard time wrapping my head around it. I have written plenty of c++ and c# but xmal seems a bit foreign to me right now. I have created a main window that has a grid. Within the grid i have a user control that i dynamically create buttons. Depending on which button the user presses the control should load another user control in place of the current control, kind of how a win7 phone would work... This is a desktop app not a phone app.. just wanted to give you an example of the desired result. I have looked at Pages and Navigation but i don't think this what i'm looking for. Can someone please point me in the right direction. Thanks
You could put a "ContentControl" in your Xaml
and than in your code change it's content, like:
ContentControl1.Content = new MyUserControl();
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.