Quick tip: Commenting out properties in XAML

Often when you write XAML, you wish you could ignore a property temporarily. In code, it is easy to do: Just comment out the line where the property is set, and you are good to compile.

Read the rest of this entry ยป

Print | posted on Monday, February 1, 2010 5:26 AM

Feedback

# re: Quick tip: Commenting out properties in XAML

left by Jose Luis Latorre at 2/1/2010 10:59 AM Gravatar
Nice trick! cool!

# re: Quick tip: Commenting out properties in XAML

left by Raghuraman at 2/1/2010 11:02 AM Gravatar
Neat.

Thx for this tip.

# re: Quick tip: Commenting out properties in XAML

left by Graeme Hill at 2/1/2010 2:11 PM Gravatar
Definitely a very useful trick, but I have found that you need to be careful with this. Sometimes I forget that a property has been ignored and I can't find out why the UI is behaving differently. Usually when you look at code it is really obvious that something has been commented out because the syntax highlighter will give it a different colour, but in this case it just looks like regular code.

In many cases it's still way better than just deleting the property though.

# re: Quick tip: Commenting out properties in XAML

left by shemesh at 2/3/2010 7:18 PM Gravatar
NICENESS !

# re: Quick tip: Commenting out properties in XAML

left by Viktor Larsson at 2/17/2010 2:16 AM Gravatar
Nice although a workaround. We really should be able to comment in the middle of code. Still useful though :)

# re: Quick tip: Commenting out properties in XAML

left by Michael Brown at 5/12/2011 2:50 PM Gravatar
What if you want to ignore an attribute that already has a prefix?

# re: Quick tip: Commenting out properties in XAML

left by Cory Plotts at 5/13/2011 3:17 PM Gravatar
Love it ... know if it only highlighted the ignored sections green ...

# re: Quick tip: Commenting out properties in XAML

left by Cory Plotts at 5/13/2011 3:19 PM Gravatar
I mean ... _Now_ if it only highlighted the ignored sections green ...

# re: Quick tip: Commenting out properties in XAML

left by Laurent Bugnion at 5/16/2011 12:01 PM Gravatar
@Mike: I don't have a solution for that.
@Cory: I agree, oh yes I agree...
Comments have been closed on this topic.