Goal: Edit the ControlTemplate of a Window to remove the caption buttons via Blend (Close/Minimize/Maximize). Why? Need a window with a title bar (draggable) that can't be closed/minimized/resized. It's a temporary status window that pops up, etc. (I've seen solutions that go into the Win32 APIs, and wonder why. This should be doable via Blend!)
Anyway... Blend for Visual Studio 2017 seems to be OK with my attempt. At least initially.
Click "[Window]" in the Document outline and then select "Edit Template => Edit a copy"
Blend complies and gives me this control template.
However, immediately the XAML is flagged as having errors.
I figured "well, maybe this is just a designer issue. Maybe it will build." Nope.
"The type reference cannot find a public type named 'WindowInstance'.
"The name 'WindowInstance' does not exist in the namespace
'clr-namespace:Microsoft.VisualStudio.DesignTools.WpfDesigner.InstanceBuilders;assembly=Microsoft.VisualStudio.DesignTools.WpfDesigner"
Well, I've looked for "Microsoft.VisualStudio.DesignTools.WpfDesigner" on both NuGet and in the install folders and it doesn't seem to be there.
I've also read this solution, which mentions adding "Blend for Visual Studio SDK for .NET" in the Visual Studio 2017 installer under the "Individual Components" page. I've done that. Still I have the error.
I'm uncertain where Blend got the initial ControlTemplate from in the first place if it doesn't resolve to an assembly on my machine.
Regarding the actual solution... what I'm doing now is faking a window with a title bar (that has no buttons) and using the system brushes to make it look like a window with a title bar--but that isn't draggable... which is another problem to solve.
Really, why I can't do something as trivial as removing control buttons from a window is beyond me. I suppose there are philosophical reasons to not allow people to remove the close button on a window, but that shouldn't be some arbitrary call that a dev at Microsoft gets to make for me or anyone on my team.
Thank you for your assistance.
Chad.
I have a wxwidgets (2.8) app that works great on Linux but on Windows the combo boxes are suddenly read-only. What do I need to do to get it to allow typing on Windows too? I process text events but I can't get characters typed to be recognized. Is there anything special on Windows that needs to be done?
In essence I am trying to use the combo box as a filtering select (like an autocomplete) and it works fine on Linux. Is something seriously wrong here on Windows?
Now, I am using wxperl and I have looked at the documentation, but when I type in the combo box on Linux/GTK it works but on Windows nothing appears. Am I missing a styling option or something? What differences in underlying widgets can account for this?
EDIT On further investigation they don't appear to be fully read only, but the text event seems to remove the text in the box, so this appears to be an issue with event handling. In essence, how do I process a text event without losing the value?
I found the problem. The issue is that Clear clears the value of the combo box on Windows but not on GTK. The solutions to fix the problem are not as readily portable across platforms as I would like but that is not that unexpected.
I've become accustomed to the WPF designer, I'm wondering if it's possible to align a form in the center of the designer, rather than top-left.
The answer is no. The designer in VS 2010 does not allow the user to situate the form in any other configuration.
The short answer to this question is "No", visual studio does not have this feature. While there are not any good options what I can think of to address this is to take a look at Sharp Develop, an alternative open source solution to Visual Studio and if that does not have this feature in it, you can submit a bug into their issue tracking system and hope someone picks it up. Perhaps if you are feeling frisky enough you can even take on this IDE feature yourself and submit a patch. Like I said, not a good option, but it's an option.
Go the designer view, then go to the start position into the properties, and then set I to the center screen
Is there any way to force the WPF designer to reload or refresh, without rebuilding the entire project or solution?
If there's an error, I get an option in the designer view to refresh the designer. But if I don't have an error, how can I get the designer to refresh after I've made a change?
I'm a little late but this is the best solution1 I've found so far: whenever the designer does stupid stuff, I just kill it's process.
Press Ctrl+Shift+Esc
Navigate to the Processes tab.
Kill XDesProc.exe
This also fixes issues for the properties window (like when it gets jammed and you can't type stuff into it).
1 This is a solution for designer issues. Your issues may also be caused by compilation problems, in which case just right click on the solution in the solution explorer, and clean it. The reason behind it is that sometimes the compilation loses synchronicity with the generated files from XAML, and cleaning the solution just deletes those intermediate files; it's like a reset so your compilation can start off with a clean slate.
To do it fast:
Comfortably it's usually the last one if sorted alphabetically.
When it is, it's almost like a ritual for me to quickly pop up the task manager, click any process, press End, Delete, Enter (done), Esc (exit task manager). Instead of restarting VS and waiting for all the loads & unloads, you can do that in 1-2 seconds.
In newer versions of Visual Studio there is an icon on the bottom of the designer to "Disable Project code". If you toggle this off and on it will reload the designer.
You can add this to the Tools menu in Visual Studio.
Once configured, use Tools..XAML Designer Restart:
Alt+T then L
I tried configuring it for Alt+T then X but this clashed with Tools..Choose ToolboX Items.
Update
These days, I prefer to just hit Ctrl+Shift+Esc to bring up the process manager, then X to skip to XDesProc.exe then Delete to kill the rogue process(es).
The Visual Studio designer attempts to keep the rendered view in sync with the XAML. That's the advertised behavior.
The first thing you should check is that there are no errors in the errors window. It may be something as simple as a missing angle bracket.
The second thing to check is whether you have any code (other than your code-behind) which needs to be compiled for the designer to render your XAML correctly. This includes any of your own datatypes that you instantiate in XAML, any custom controls you have written (e.g. MyTextBlock derived from TextBlock), or any classes directly or indirectly in support of design-time data. If so, you need to rebuild your project.
The last thing to check for is possible bugs in the designer. In spite of the advertised behavior, the designer may get out-of-sync due to bugs. In that close, close the XAML window and re-open it. Other tricks that might work are selecting the XAML tab and then the Design tab, or maximizing the XAML pane.
As far as rebuilding your application goes, you don't need to do this as a habit. You only need to recompile it when the above conditions apply. Once they don't apply, you can just edit the XAML. Another way to say this is that if you haven't modified code, you shouldn't need to rebuild (modulo bugs).
I'm not sure, but I think a build will refresh your view in that situation.
There is any event handled in that XAML file, then mostly it will not display the design preview from Visual Studio. If you want to see the design from Visual Studio, try with Command Binding instead of event, you will see the preview.
I'm not sure how this works in WPF editing, but with ASP.NET pages when the design view wont update i can do 2 things
Exit Visual Studio and restart
Go into source view (not split), type something and remove it (not by undoing, just delete or backspare) and save it. Then return to design view, usually the view has been updated then.
When you add a new row of code or a new object, XAML designer is sync but I encountered non-sync behavior when a property of an object is changed.
A tricky way is that when you change a property you only need to remove a ">" character from end of an instruction then retype it.
On the toolbar in the XAML designer, choose the "Disable project code" button to reload the designer link which stays on the right side of "Turn on snapping to snaplines".
Disable project code in the designer
If it is disabled, you can try to check the configuration manager and change processors to "Any CPU".
For projects that target ARM or X64 processors, Visual Studio cannot run project code in the designer, so the Disable project code button is disabled in the designer. Check this:
Debug or disable project code in XAML Designer
For information, I had the same issue with the XAML Designer of Visual Studio Community 2017, i.e. sometimes the designer doesn't show anything, the easiest solution is then to close the XAML file and reopen it.
I also frequently get the exception "An Unhandled Exception has occurred - Click here to reload the designer - Details: The XAML Designer has exited unexpectedly" (the click restarts the designer successfully).
Note that, in this VS version, the process of the XAML designer is not named XDesProc.exe, but UwpSurface.exe. If you prefer or have to kill the process, then the designer shows the same exception as above, and you may restart it.
use process hacker and kill the WpfSurface process (blend only)
Update for designer refresh/reload Visual Studio 2022 Xamarin, taskkill /IM java.exe
Background: I've got a WinForm application with a ComboBox and a TabControl with two pages. On page one of the TabControl, I've got a FlowLayoutPanel containing about 10 Panels. Each of those Panels contain a Label and a TextBox. I'm using Visual Studio 2008 as my IDE.
Problem: I'm not able to tab between any of my controls. I go to View-Tab Order, and everything looks fine (although I know it's not). All I get is a system beep when I try to tab between controls.
Anyone else have a similar problem that they overcame? I'm sure I'm missing something really simple, but I don't know what it is. Is there a method to have Visual Studio rebuild the tab indexing?
Figured it out. Instead of using Form.Show(), I used Form.ShowDialog(). Tabbing work correctly after that. Not sure why though.