Adding custom glyph of a break point in Visual Studio - c#

I want to create a custom breakpoint type that will break for a duration then continue. I can mark a breakpoint as this new custom type with a command in its context. Is it possible to change the red glyph of the breakpoint to one that is blue or maybe even a different shape? I cant find any literature about it anywhere. I think I could make a custom text view port adornment for a separated breakpoint marking column but things would be less complicated if I could just change the glyph. I am working with wpf. Thanks in advance.

Turns out that this is possible with the IGlyphFactory.
Read this to see how its done.
https://learn.microsoft.com/en-us/visualstudio/extensibility/creating-an-extension-with-an-editor-item-template?view=vs-2019

Related

How to get back Visual Studio's old way of alerting of suggestions by darkening code instead of by 3 dots?

Visual Studio used to alert us of unused variables by darkening them. Now (version 16.10.2) it fills the code with three dots everywhere, which look a little like code and are more confusing.
Is there a way to get the old way back?
There is a color control for the ellipses called "Suggestion Ellipses...". You could set the foreground color of it to the same color as your editors background to get a sense that its turned off. You'll still see it when you select the item though like so:
Version 16.10.3 now
It looks like they changed it back.
So if you still have it - update VS.

Why composition animation(example in UWP docs) is not working?

The simple animation example show in the Windows UWP docs under the section of Visual Layer and sub-section of Time animation is not working...
Above is the code example shown in the docs.
Above is the code of XAML rectangle that I am animating.
Above is the code I have written, similar to the code in first image.
Now this is the error I am getting every time I run the app in debug mode. The property was not found. But that is what is written in docs, then how could it be. One more thing I have tried setting the property to renderTransform as well but that doesn't work either.
What am I doing wrong?
Adding another answer because the one here isn't entirely correct - whilst the example IS wrong, there is in fact a Translation property on Composition Visuals that come from XAML objects - that is also most likely preferable to using offset if your animating a visual of a XAML object.
Firstly, you need to enable the translation property on the element like so:
ElementCompositionPreview.SetIsTranslationEnabled(uiElement, true)
Secondly, you then need to change the animation property to actually target the correct property:
visual.StartAnimation("Translation.X", animation);
This only works if you're targeting the creators update or above.
Using Translation over Offset entirely avoids issues where XAML layout updates break the animation - as XAML position updates will overwrite a Visual's Offset and stop any current animation, whereas Translation animations will continue to run unabated of what the XAML layout engine does.
I believe that the example is wrong. The Visual object have no properties like as "Translation". To move it from left to right,
visual.StartAnimation("Offset.X", animation);
or
visual.StartAnimation(nameof(visual.Offset) + "." + nameof(visual.Offset.X), animation);
I have very simple example code of animate the object with UI.Composition on GitHub. The comments are all Japanese, but it may help you, I hope so.
CompositionGridView

How to fix rectangle height in Reportviewer Visual Studio

I am working with Visual Studio 2010 ReportViewer WinForms.
I have been unable to figure out how to fix the rectangle height in a report. I've tried using a table within the rectangle, also a table in a sub report that is placed in the rectangle of the main report with no success.
Basically, I am setting up an invoice-type report that must keep its' form and should not be allowed to grow so that elements are pushed onto a second page.
Both rectangle and tables will always grow vertically based on the content. There is no way to really stop this.
There are a couple of properties that might be able to help you get the correct page breaking in place:
KeepTogether indicates whether to keep all sections of the data region together on pane page.
When set on true and the region is to large to fit the page, this will add a page-break before the start of the region to try and fit as much as possible on a single page.
So if you wish for the region to start at the initial location but break afterwards, make sure this is to false.
PageBreak has the parameter BreakLocation which can be used to determine a fixed place to add a page-break. You can set it on Start, End, StartAndEnd or Between.
You could split your report in fixed pages and use these to add standard page-breaks in the desired (fixed) locations.
These properties alone might not be enough to get your desired result. Especially when working with tables it is hard to add a page-break after a fixed amount of rows.
It is hard to give you a detailed description of a possible approach with the amount of information you gave me, but here is some general advice.
You should split your data in the correct intervals before sending the datasource to the reporter. You can for example use grouping to place them in the correct intervals and add page-breaks based on the grouping.
Another solution is to add them in separate containers, this will require you to have enough spare data regions at your disposal. If there are too many you can always hide the empty ones based on an expression set for the Hidden property.
It won't be easy to set this up correctly so that it can dynamically grow. It takes a lot of puzzling from your end but pretty much any layout should be possible to achieve.
I wish I could give you a more specific solution to your problem and am willing to help you further if you give me an example to work with. But ultimately this is something you should be able to achieve on your own.

trackbar appearance with backcolor

How to make a trackbar like this picture? If its unachiveable with the trackbar, what other methods are there to achieve something similar?
I would have a sql populate the values too.. any suggestion on how to approach this?
An example would be for PH reading we have a set of values to be maximum and minimum, the slider would be the current value of the object. The green zone is the first warning values, the yellow is the danger values.
I found two links by which you can customize TrackBar in C# visual studio. It is not the exact solution to your question but I believe if you play around with this u can find out what you want.
Code Project .com
ViBlend
Regards

How to enable Virtual Space in AvalonEdit?

I want to achieve "Virtual Space" functionality, similar to one in Visual Studio, in AvalonEdit.
I.e. the caret could be positioned beyond the end of the text line, and if you press any key, there would be spaces automatically added to match.
I am very used to this feature, but neither Googling nor studying AvalonEdit's code gave me any clues on how to enable it, if it is supported at all.
If it is not, suggestions how to extend caret handling mechanisms would be nice.
Thanks!
Edit:
Virtual space support has been added to AvalonEdit in version 4.2.0.8283.
Set textEditor.Options.EnableVirtualSpace = true;.
Below is my original answer.
It's not currently supported.
If you want to try adding it, make sure you read the "coordinate systems" documentation (in the help file on CodeProject). You'll want to extend the "visual column" so that positions after the line end are valid. And you'll have to adjust the position<->column calculations (VisualLine.GetVisualColumn and friends). Use TextView.WideSpaceWidth to figure out the columns past the end of the line.
The above should allow you to use the mouse to place the caret in virtual space. After that, you'll need to change the caret movement (arrow keys, CaretNavigationCommandHandler) and text input logic (TextArea.PerformTextInput) to also support the virtual space.
And if you're successful with the above steps, don't forget to contribute your changes back to AvalonEdit. :-)
While I'm not a fan of virtual space myself, we need something like it to make the RectangleSelection work properly.

Categories