VS2010 Remove grid lines in WPF Design View - wpf

Is there a way to remove the annoying grid lines in the design view of Visual Studio 2010? Or at least style them to fade them off?
I'm not referring to the Grid component, but to the design view in WPF which draws visual lines over and around every components, making screens look like a soup in design view.

In Blend, if you disable Show Handles (in View > Show Handles, or F9), you can turn off those stupid blue lines.

Pretty sure you can derive from Grid and build design-time meta-data assembly with it as described on this msdn blog:
http://blogs.msdn.com/b/wpfsldesigner/archive/2010/01/13/wpf-silverlight-design-time-code-sharing-part-i.aspx#required
The reason I suggest deriving from Grid is because you want the designer to load new meta data for the type. Hopefully this implementation will override default behaviour although I have not tried myself.
Can I ask why you want to make this change? I am interested.

You say not the Grid component but those blue lines are part of the Grid control and you can simple drag them off the screen to remove them. I do not see any other light blue lines in that first link. If the problem is when you are running the app then uncheck the 'show gridlines' property for the Grid in VS2010.

Related

Create a screen like control panel windows forms 2010

I am building an application and I would like the one of the forms to look like the control panel
Would you use a listview with groups?
thanks
No, I don't think you can make the ListView do this. At least not without rewriting its painting routines.
It isn't going to be easy to replicate this layout precisely in WinForms. There's nothing you can just drag over from the toolbox that is going to do it. It is possible, but it will take some effort.
What I would do, conceptually, is break it up into pieces. I count 8 different repeated "blocks". So I'd create a UserControl that models each of these.
Inside of the UserControl, I'd have a PictureBox control to display the icon, a Label control to display the heading, and a TableLayoutPanel that can be filled with the desired number of LinkLabel controls. Set all of the properties of the controls so that they match, and then write public methods to set the icon, heading, and add/remove links.
Then I'd drop a TableLayoutPanel onto my form, set the margins to have lots of whitespace, and add as many of those UserControls as necessary. At the top of the form, of course, you'd need another Label to display the heading/instruction text. Make the form's background white, and you're pretty much there.
The logic to switch between views isn't implemented, but consider whether you really need that. It is important in Windows because users are used to the old way of doing things. This doesn't apply to you.

Customize my ScrollViewer/Scrollbar in xaml/wpf

I am really bad when it comes to styling in XAML and I have a really big problem. I want to customize my scrollviewer in the ListBox that I have. I want to look something as simple as this
I hope that someone can help me do this.
Thanks in advance.
If you're using Expression Blend this is pretty simple actually. First you need to get to your Control Template for your ScrollBar. You can do this by dropping a ScrollBar control on your Design Surface then right-click and choose "Edit Template -> Edit A Copy" which will present a box to enter the name of your new Style Template and whether you want to save it to a Resource Dictionary or to the file you're working in.
Once you have saved it you should see multiple Parts in your Objects & Timeline panel for the Vertical & Horizontal templates of your ScrollBar. You will be editing the properties of the Rectangles & Borders that create the visual of your Scrollbar within each Control Template for Horizontal & Vertical depending on which you choose to use.
To re-create your example should be relatively easy with finding the "VerticalThumbTemplate" or "HorizontalThumbTemplate" and editing the Border / Rectangles within them to get your oval as you display. You might also want to tinker with your VisualStateManager States while you're in there for MouseOver effects etc.
An example of a custom scrollbar can be found in a partial theme I created awhile back you can view here.
Once you have created your custom ScrollBars you can either make your new style template the default by changing the BasedOn Value for that TargetType, or applying it directly to the ScrollViewer built in to your ListView Template.
Hopefully this should be enough to get you started in the right direction. Cheers! :)
Scrollbar is one of the harder template to customize. If your are really bad at that, you maybe have to search at a custom controls librarie.
But if you really want to edit the scrollbar template, there is plenty of sites that will help you with a simple google search

C# - How does the ToolTip work?

I was wondering how I am able to add one ToolTip control to the Form, and all the buttons get different texts? How does one object extends all the others, adding diferent things on each one? I don't know if I am being clear, If I don't, please let me know!
Thanks in advance!
I think you are looking for Extender Providers, where you can define new properties for other components.
This is a feature of Visual Studio designer. The ToolTip control does not actually add a property to other controls, but Visual Studio knows that when you have a ToolTip (or any other component that is an Extender Provider), it should add some other properties to property grid of the other controls. All this information is queried from the component that provides those properties (ToolTip). When you set the tooltip for button for example, Visual Studio calls the SetToolTip method of the ToolTip control, to inform it of the new value for the control.
Please refer to provided links for more information.
It's actually very simple.
Lets say you have a windows form with two controls a button and a label.
Now add a tool tip from toolbox to your form named tooltip1.
Now right click on button and go to properties, scroll down until you find tooltip on tooltip1. set the text to whatever you want. Now do the same for label.
Run the program and move the cursor over both the controls. you'll see respective tool tips.

WPF UI Related question

realy i don't know what i should title this problem, i hope to "WPF UI Related question" is accept able.
consider something like that form who you explore a class diagram in Visual Studio.
you select any class object in window and than right click on it then you select "Properties" menu Item and then a window will pups up that allow you to change selected class object.
or something like Auto Cad. when you draw a line you can right click on it and then select Properties menu item and then with appeared window you can change line's properties (like color of line or any thing like that).
now i want to create an application with an User Interface like these who mentioned on upper lines.
i want to create an UI that i cad draw circle and squares on it (with mouse clicks) and then when i want a "Properties" window will appeared to change objects's properties.
also with this capability that wheeling mouse wheel up-down will results in zoom in/out the screen (like Auto CAD).
finally my question is that is there any kind of frameworks or pre created controls that i can use them for achiving these goals or i have to implement all these my self?
thanks all and sorry for my bad english..
You can use this for your property grid:
WPF Property Grid
for giving zoom capability i use this and for property windows i use this.
thanks to Yogesh...

How can I prevent the VS WPF designer putting margins on every object from the toolbox

When I drag a control from the toolbox on to the Visual Studio 2008 WPF design surface, it sets a margin based on where I dropped it and a default size.
Is there any way to prevent VS setting those? When I drop a control on a stackpanel I want it to flow in to the existing controls in the panel.
Thanks!
I've never found a way to prevent this. I just type the XAML instead.
EDIT:
I wrote the above nearly three years ago. In the meantime, it would appear that the design-time experience has gotten a lot better.
While the designer still adds hard-coded margins if you drag-and-drop, there are ways to remove those margins without having to do it by hand.
Here's a link to an article that illustrates how to use design tools in Visual Studio 2010 to lay out a form without having to type any XAML. (Despite the title, it's about WPF.)
The first part of the article shows hard-coded pixels, but I've linked to the second part that shows how to lay out the controls without that hard coding.
Layout Techniques for Windows Form Developers
When I drop a control into a stackpanel, it doesn't add margins, it "flows" in with the rest.
The controls you drop onto the design surface have a margin by default because that's how it knows where it's placed. What I typically do is create a grid and set it's margin where I want it, then create columns and rows to put controls into. I drop in my other controls which will add margins which are usually not what I want. After I have all my controls into my grid, reasonably placed, I switch to XAML view and either remove the margin completely (which causes a control like a button to fill the entire space), or make the margin something like 5, which puts some nice padding around the control.
Bottom line...and this is especially true with Silverlight development, you must get used to manipulating the XAML directly. It's the only way you'll get the layout exactly where you want it. This is my opinion and most everybody in my shop who does WPF/silverlight development.
Unfortunately there does not appear to be a means to do this.
The default size is set as a result of you manipulating the size of your control is the designer. When you increase the width and/or height of a control the designer is interpreting your actions as a request to make the control that specified width and/or height.
A similar situation is encountered with the margins. As you alter the position of your control within the designer, it modifies properties to achieve the layout you've created. In the case of most containers the simplest solution is to modify margins in order to achieve the desired position, as you've already pointed out the simples solution is not always the most desired.
Personally I prefer to only use the XAML editor and only occasionally take a peak at the WPF Designer when I want to see the current layout. I also tend to favor using the Grid to layout most of my windows/controls as it provides the greatest flexibility not only for sizing and positioning, but for other tasks/features such as animations, transforms, etc.

Resources