I cannot figure out how to bring a TabItem to the front of a TabControl in a visual studio 2008 wpf project so that I can see the controls I'm editing.
The visual display part only ever shows the controls on the first TabItem. It does works in run time, just not in design time.
Sounds retarded, maybe I am, but I can't figure out how and I'd really appreciate if anyone could tell me how?
I've tried bringing things to the front, pushing things to the back? Clicking through document outline, looking through properties, double clicking, pulling my hair out, banging my head on the wall....
How can something so simple elude me? :(
Thank you.
Setting the IsSelected property on the TabItem works but it's obscure to say the least and kludgy at best.
This problem has in fact been fixed to work the way you would expect it to work since 8/11/2008 however Windows Update doesn't notify you that the update is available, not even if you check from the Visual Studio 2008 "Help>Check for Updates" menu item. I just ran across this issue myself as I was migrating to a new laptop where the Tab Control worked properly on my old machine but not on my new machine. On closer inspection I found that the difference was that the Visual Studio 2008 SP1 was missing, once I installed that the Tab Control started working properly again. Go to;
http://msdn.microsoft.com/en-us/vstudio/cc533448.aspx
This makes me wonder though, even before the update to VS2008 the Tab Control worked properly in Expression Blend and since the SP1 update was to VS2008, not to the .Net framework, the control shouldn't have changed. So, did Microsoft write the design time behavior for the Tab Control into the UI vs the control itself? That would be very wierd but how would it work in Blend and not VS2008 if the design time behavior was in the control? Maybe Blend and VS2008 each have their own set of control templates that handle design time behavior? You would think that the two programs would share them if they did. Hmmmm...
PS: Don't forget to install the 3 security updates to VS2008 SP1 that Windows Update finds now, 500MB holy cr_p batman.
Use the IsSelected property on the TabItem
<TabControl>
<TabItem Header="Tab1">
<TextBlock Text="This text is not visible"/>
</TabItem>
<TabItem Header="Tab2" IsSelected="True">
<TextBlock Text="This text is visible" />
</TabItem>
</TabControl>
Related
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 problem with Visual Studio 2010. It happens when I scroll down/up, for example, in properties window. Its content becomes blurry for milliseconds.
It also happens in my own WPF applications when I use a “ScrollViewer”.
Does anybody know how to solve it?
In your own WPF applications it is possible to constrain scroll offsets to device pixels by using a custom IScrollInfo implementation. This is easy enough to do. Note that you will have to get the actual screen DPI to do the calculation.
In Visual Studio there is no "reasonable" way to fix it. Obviously you could hack up the VS.NET executables to include your own IScrollInfo implementation, but I wouldn't recommend it!!
Just about the only way to avoid the problem is to avoid WPF entirely. As nice as it is in some ways, it still1 doesn't get text entirely correct. And yes, WPF is the source of the problem in Visual Studio -- as of VS 2010 they switched parts of it to use WPF.
1"still", in this case referring to the fact that it used to be even worse. As of .NET 4.0 they've fixed some of the most egregious problems, but (as you've seen) it's still not really right.
I had the same problem. There is actually a way to fix this while scrolling.
Just add those 3 attributes to your content control:
SnapsToDevicePixels="True" UseLayoutRounding="True" TextOptions.TextFormattingMode="Display"
Just note that the text might not look as smooth as it should while scrolling (instantly goes away once you stop scrolling though)
When I return from debug mode, my visual studio 2008 environment takes a really long time to display the properties of a UI control (e.g. text box) I click on.
why does this happen? Is there a hotfix or update for this from microsoft?
Thanks for any help in advance.
Subbu
If you are using WPF, then this might be normal :) VS doesn't have a very quick WPF UI designer. Get Expression Blend, its designed for such things. If you're using WinForms, I'm not sure. I've often felt slowdowns when using 3rd party WinForms controls, such as Telerik or DevComponent's DotNetBar, but it is because references to these controls bring in huge DLL's of which you often only use a small portion of. It leads to bloat, which can slow down a UI designer. Hope this helps.
I've been trying to get to the bottom of an issue with binding the SelectedItem of my ComboBox, and since I've had no success thus far, I started looking at ways to get more detailed debugging information by setting PresentationTraceSources.TraceLevel=High for specific bindings. Unfortunately, after doing so I don't see any related items in my Output window under the Debug category.
I'm using Visual Studio 2010, and my project is a WinForms project with heavy usage of interop using ElementHost to host WPF content. All related projects are currently being built for .NET 3.5. Any thoughts or suggestions that may lead me to the solution of seeing the extra trace information in the output window will be appreciated.
Below is a snippet of the code I'm using.
<ComboBox xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase"
SelectedItem="{Binding Path=MyCollection.SelectedItem, Mode=TwoWay, diagnostics:PresentationTraceSources.TraceLevel=High}"
ItemsSource="{Binding MyCollection, diagnostics:PresentationTraceSources.TraceLevel=High}"
SelectedValuePath="Value"
DisplayMemberPath="Value.DisplayName" />
It's a setting in the Visual Studio 2010:
Tools -> Options -> Debugging -> Output Window -> WPF Trace Settings -> Data Binding -> set to Warning (or whatever you like).
Standard was Off.
This solution worked for me.
Make sure that your DataContext is not null. If it is, no information will be logged to the output window
Also see this answer here -
https://stackoverflow.com/a/50282982/3984575
Summary: make sure you are not overriding the settings with a line like this in your code -
System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = System.Diagnostics.SourceLevels.Critical;
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.