I encountered an old foe, on the workstation of my day job, after installing Visual Studio 2010 Premium. Moving the mouse scroll wheel normally causes my C# code window to scroll vertically. However, this particular computer randomly decides vertical scrolling is simply too mundane, and starts scrolling tool windows, instead. I have experienced this problem in the past, after installing Visual Studio 2003 on a HP workstation. The issue was resolved after I updated the mouse drivers to use the standard Microsoft Windows mouse driver. The mouse worked beautifully! But, what was the cause of the problem?
09 August 2010
05 August 2010
Practical Uses of Visual Studio 2010 Productivity Power Tool Extensions
at
20:09
This is an unbiased review of practical uses for the new Visual Studio 2010 Productivity
Power Tool Extensions. I waited to post this for a good reason;
there are numerous posts reviewing and highlighting the functions of the extension,
but none about how they are really useful and actually used to increase your productivity. Most
users will figure these things out in time; however, for those who are unfamiliar
with this extension, or extensions in general, it's great to get an idea of what
what the Power Tool extension do for you.
28 July 2010
User Control Design Time Detection
at
15:53
Today, I created a wizard application in WPF/C#. Each "page" of the wizard is a user control. Each user control is largely autonomous, each having a pointer to a singleton instance DataManager class that persists data between the controls and parent window. When a control is made visible, it checks the values of the DataManager class, to ensure the requisite values are available, etc.
The "page" controls are not instantiated on-demand, for reasons I will not discuss here. When viewing the main window in the WPF designer, all of the user controls that perform data verification in their IsVisibleChanged event handler cause the WPF designer rendering to fail, although I did get several MessageBoxes containing the various validation error messages. (At least I know those work well!)
The solution is to wrap all validation logic in an IF statement that checks to see if the control is being rendered in a designer. It we are indeed in design time, the validation logic is stepped over.
The "page" controls are not instantiated on-demand, for reasons I will not discuss here. When viewing the main window in the WPF designer, all of the user controls that perform data verification in their IsVisibleChanged event handler cause the WPF designer rendering to fail, although I did get several MessageBoxes containing the various validation error messages. (At least I know those work well!)
The solution is to wrap all validation logic in an IF statement that checks to see if the control is being rendered in a designer. It we are indeed in design time, the validation logic is stepped over.
private void UserControl_IsVisibleChanged(
object sender,
DependencyPropertyChangedEventArgs e)
{
if (DesignerProperties.GetIsInDesignMode(this)
|| this.Visibility != Visibility.Visible)
return;
// Validation logic here...
}
20 July 2010
Reverse TextIndent (Outdent) for FlowDocument
at
09:27
WPF FlowDocuments are extremely useful and format very nicely, so long as you are writing plain text. The tag kindly provides a TextIndent attribute, to indent the first line of the paragraph. But, what about formatting for nested code?
Margin doesn't look kindly upon inserting negative values, but TextIndent gladly accepts them. Using a combination of a negative TextIndent and a matching, positive left margin, the Paragraph is coaxed into outdenting the first line. This visually appears that the first line is even with the other paragraphs, and the following lines are indented.
Produces the following:
Admittedly, this works well for the first indent, but any further indentations must be handled with a bit of creativity. I will leave you to decide how to best handle that situation.
Margin doesn't look kindly upon inserting negative values, but TextIndent gladly accepts them. Using a combination of a negative TextIndent and a matching, positive left margin, the Paragraph is coaxed into outdenting the first line. This visually appears that the first line is even with the other paragraphs, and the following lines are indented.
<paragraph
margin="25,0,0,0"
textindent="-25"
FontFamily="Courier">
First Line
Second line
Third Line
</paragraph>
Produces the following:
First Line Second Line Third Line
Admittedly, this works well for the first indent, but any further indentations must be handled with a bit of creativity. I will leave you to decide how to best handle that situation.
Subscribe to:
Posts (Atom)