In my wpf application, I have a requirement to format the textblock to show code snippet. Is there anything out there that already does this?   So return VSConstants.S_OK; should in the textblock show up as,
123881
I want create my own IDE but I want a code editor that would syntax highlighting.  I want to embed it as a control into a WPF window.  Malcolm
113526
In WPF, how would I apply multiple styles to a FrameworkElement?  For instance, I have a control which already has a style.  I also have a separate style which I would like to add to it without blowing away the first one.  The styles have different TargetTypes, so I can't just extend one with the other.
75120
In a visual force page, I can take a date and do this...  &lt;apex:outputText value="{0,date, MMMM d,  yyyy}"&gt;     &lt;apex:param value="{!relatedTo.my_date__c}"/&gt; &lt;/apex:outputText&gt;   I want to be able to do that in Apex code.  So I want a method which takes a date and returns a certain format as a string.  I check the API:   and sorry if I am stupid but not so obvious how to do this?  Many thanks.
101910
There's a question that was recently asked found here:   The question asks about bindings in WPF but makes no mention of MVVM or a ViewModel class. Someone answered     You could do the behind in the callback of the event Checked of your radiobutton..      Something like :      Binding b = new Binding("ShippingAddress");   _textBox.SetBinding(TextBox.TextProperty, b);   Which is technically correct, but HighCore's kind of throwing a fit over the fact that bindings are being done in the code-behind when they should, ideally, be done in a ViewModel class, adhering to the MVVM pattern.  In cases like this, should we submit answers involving use of the MVVM pattern even though the user might not have MVVM implemented (as HighCore did), recommend they implement the MVVM pattern, or answer the question as it is (as franssu did)?  I'm in agreement with HighCore that bindings really should be done in a ViewModel, but I don't think it's proper to throw a fit about it when that's not what OP was asking for and the answer submitted does fulfill OP's question.  Edit: I am rescinding my above comments.  Given the situation, HighCore's behavior was warrantable. Franssu's answer is viable but promotes bad practices.
19059
is there a way to pass a string to the &lt;apex:outputText&gt; so that it can be formatted as a currency or percent value?  Here's what I have inside a column of my visual force table:  &lt;apex:outputText value="{0, number, currecny}"&gt; &lt;apex:param value="{!row.values[1]}" /&gt; &lt;/apex:outputText   this gives me an error at runtime (when the visual force page loads), which I think may be some kind of type mismatch, where &lt;apex:outputText&gt; is expecting a Decimal or number but I am passing a string.  This is the error at runtime:     The value attribute on  is not in a valid format. It must be a positive number, and of type Number, Date, Time, or Choice.   Thanks
47851
What does InitializeComponent() do, and how does it work in WPF?  In general first, but I would especially be interested to know the gory details of order of construction, and what happens when there are Attached Properties.
121940
I know this maybe a basic question but I just can't seem to find the answer anywhere.  I have a class like this  Table&lt;T&gt; {}   then I have some code that uses the above class that I would like to comment I would like to be able to do something like:  /// &lt;summary&gt; /// blah blah blah Table&lt;String&gt; /// &lt;/summary&gt;   But I can't use the angle bracket in the comment as it thinks it's a tag and when the help shows up it just has an error about no end tag for .  How do I show generic classes in comments in Visual Studio.
25314
In  I tried to add  for syntax formatting to code blocks quoted from the question. However, it seems they won't be honoured if I write them as a comment in my own part of the post, and if I include the hint in the qutotation as well then I have some ugly empty space before the code block. There should be a way to write these things properly.
53171
Formatting numbers on a VF page, but I do a bunch of processing the Apex Class, so I would rather return the formatted String value from the controller.   I am doing something like this, but I just want the second number to appear as "(1500)" rather "-1500"  Getting lost in the Message Format docs, so hoping someone can guide me in the right direction...  List&lt;String&gt; args = new String[]{'0','number','###,###,###'}; system.debug('Positive' + String.format(  ( (1000) - (500.50)  ).round().format(), args) ); system.debug('Negative' + String.format(  ( (-1000) - (500.50)  ).round().format(), args) );
59535
One feature of SO that pains me every single time is having to manually indent all code four spaces, and usually copy four spaces to the clipboard so Ctrl+V acts as 'Tab'.  Maybe it's on purpose to stop walls of code, but I want to discuss it anyway because everything else seems to go so smoothly and this annoys me and slows me down every day.  ....  And I JUST found the 'code block' feature after many months (having looked through a similar question or two).  I guess then can I rephrase as, 'Please make the CODE BLOCK editor feature/button more obvious' ?
47409
I have run into an issue with WPF and Commands that are bound to a Button inside the DataTemplate of an ItemsControl. The scenario is quite straight forward. The ItemsControl is bound to a list of objects, and I want to be able to remove each object in the list by clicking a Button. The Button executes a Command, and the Command takes care of the deletion. The CommandParameter is bound to the Object I want to delete. That way I know what the user clicked. A user should only be able to delete their "own" objects - so I need to do some checks in the "CanExecute" call of the Command to verify that the user has the right permissions.  The problem is that the parameter passed to CanExecute is NULL the first time it's called - so I can't run the logic to enable/disable the command. However, if I make it allways enabled, and then click the button to execute the command, the CommandParameter is passed in correctly. So that means that the binding against the CommandParameter is working.  The XAML for the ItemsControl and the DataTemplate looks like this:  &lt;ItemsControl      x:Name="commentsList"     ItemsSource="{Binding Path=SharedDataItemPM.Comments}"     Width="Auto" Height="Auto"&gt;     &lt;ItemsControl.ItemTemplate&gt;         &lt;DataTemplate&gt;             &lt;StackPanel Orientation="Horizontal"&gt;                 &lt;Button                                                  Content="Delete"                     FontSize="10"                     Command="{Binding Path=DataContext.DeleteCommentCommand, ElementName=commentsList}"                      CommandParameter="{Binding}" /&gt;             &lt;/StackPanel&gt;                                 &lt;/DataTemplate&gt;     &lt;/ItemsControl.ItemTemplate&gt; &lt;/ItemsControl&gt;   So as you can see I have a list of Comments objects. I want the CommandParameter of the DeleteCommentCommand to be bound to the Command object.  So I guess my question is: have anyone experienced this problem before? CanExecute gets called on my Command, but the parameter is always NULL the first time - why is that?  Update: I was able to narrow the problem down a little. I added an empty Debug ValueConverter so that I could output a message when the CommandParameter is data bound. Turns out the problem is that the CanExecute method is executed before the CommandParameter is bound to the button. I have tried to set the CommandParameter before the Command (like suggested) - but it still doesn't work. Any tips on how to control it.  Update2: Is there any way to detect when the binding is "done", so that I can force re-evaluation of the command? Also - is it a problem that I have multiple Buttons (one for each item in the ItemsControl) that bind to the same instance of a Command-object?  Update3: I have uploaded a reproduction of the bug to my SkyDrive:
18683
Frequently when I ask a question I have to include quite a bit of code for reference purposes.    It would be nice to be able to bold the important lines in the code.  For example this code:  &lt;DataTrigger Value="True"&gt;     &lt;DataTrigger.Binding&gt;         &lt;MultiBinding Converter="{StaticResource DisableWorkItemConverter}"&gt;             &lt;Binding ElementName="MainForm" Path="PickedWorkItemID"/&gt;             &lt;Binding Path="Id"/&gt;         &lt;/MultiBinding&gt;     &lt;/DataTrigger.Binding&gt;     &lt;Setter Property="IsEnabled" Value="False"/&gt;     &lt;Setter Property="IsSelected" Value="False"/&gt; &lt;/DataTrigger&gt;   Is not way long, but the important part (as seen in ) is the second to last line.  However, if I try to bold it, it ends up looking like this:  &lt;DataTrigger Value="True"&gt;     &lt;DataTrigger.Binding&gt;         &lt;MultiBinding Converter="{StaticResource DisableWorkItemConverter}"&gt;             &lt;Binding ElementName="MainForm" Path="PickedWorkItemID"/&gt;             &lt;Binding Path="Id"/&gt;         &lt;/MultiBinding&gt;     &lt;/DataTrigger.Binding&gt;     &lt;Setter Property="IsEnabled" Value="False"/&gt;     **&lt;Setter Property="IsSelected" Value="False"/&gt;** &lt;/DataTrigger&gt;   Not what I was going for.  It would be nice to be able to draw attention to specific lines of code when needed.    (One suggestion of a different color background sounds nice too (ie a yellow background to draw the eye to the relevant code.)  If there is some other way to bold in code please let me know.
31605
Ever since we got the ability to format comments, I have abused it mercilessly. I put quick code snippets in there all of the time. And I find myself often highlighting a word or two and hitting Ctrl+K, and then quickly mutter, "Ah, dammit," since it didn't do anything.  Can we please have formatting keyboard shortcuts on comments? I promise to make waffles.  Update: Kip made a timely edit of  (didn't show up in my search, dammit) where this was declined, but there's a GreaseMonkey script. However, my waffle offer still stands.
36880
Oftentimes, I want to include code samples in a list, for example:   Item One Item Two, for example: private bool ItemTwo() {     return this.IFeelLucky; } Item Three   The problem is that there isn't a good and intuitive way to do this using . It's doable, but you have to do some formatting black-magic to get it that way, which is just not "nice" to deal with.  Source that produces this:  1. Item One 2. Item Two, for example: &lt;br/>&lt;br/>&lt;pre>&lt;code>private bool ItemTwo()     {         return this.IFeelLucky;     }&lt;/code>&lt;/pre> 3. Item Three    I would love to just be able to do it this way:  1. Item One 2. Item Two, for example:      private bool Test()     {         return this.IFeelLucky;     }  3. Item Three  Which results in, well, this:   Item One Item Two, for example:  private bool Test() {     return this.IFeelLucky; } Item Three
92058
Currently it's impossible to see the bottom line of code snippets because the horizontal scroll bar is positioned over the top of them ():    Please could you add some bottom padding so that it's possible to view the last line of code snippets?  Unlike  which is a support question with a workaround answer, this is a feature request suggesting a clear action hence not a duplicate.
4554
How do I post text so that it is formatted as code?  What do I need to do so that my code shows up properly &mdash; not escaped or removed &mdash; when posted? And how to get the correct syntax highlighting?     For more information, see "" in the .
101661
Just read a couple MSO posts about editing guidelines, after seeing  getting rejected.  I had stumbled upon an old question that somehow made it onto the front page, and saw a great answer there. The question was about "understanding events and event handlers in C#", and the answer was great but there was further information in the comments.  So I started editing the post; I found that "if we create a delegate void MyDelegate(object sender, EventArgs e)" was clearer if the backtick encompassed the delegate word, so I moved it.  A commenter was asking "How is the event fired?", and the answerer replied with a comment instead of editing his answer, so I added a code snippet to give an example of how the event would be fired.  Then I noticed the code block actually included two parts that really belonged in two separate classes (the one where the event is created, and the one where the event is registered/handled), so I split the definition and the consumption of the event into two code blocks. That made it much clearer what belonged where, even though there weren't any classes involved (didn't add any).  And then I added the part why I actually wanted to edit the post in the first place: I added the shorthand notation for registering events: myObj.SomethingHappened += HandleSomethingHappened;. I left the full notation in place.  And lastly I added a line of code to show how a handler could be unregistered with -=.  As the first reviewer approved the edit, I thought to myself "hmm this last paragraph I added to introduce the -= really just restates the previous one from the original author" - shortly after that, my edit was rejected by 3 reviewers in a row.  The reason was "This edit is incorrect or an attempt to reply to or comment on the existing post." -- really? Is this how constructive edits are being welcomed? Have I introduced bad code that's just plain wrong? I mean, I use the shorthand notation all the time, I know it's correct. The -= part was just added for the sake of completeness, and the backtick would have been too minor of an edit. Reordering the code snippets and splitting them in two distinct blocks really improves the post I find, but someone who just glanced at the diff could think I removed the event handler snippet, when I merely cut it &amp; pasted it below the event registration code.  So I'm guessing the redundant paragraph killed it? Should I submit another edit, minus that paragraph? Actually I don't even care, it's a question from 2009 with almost 60K views and the answer is great enough as it is to have received 155 upvotes (plus mine), and if people don't know they don't need to new up the delegate to register the event then they can just buy ReSharper and have the tool teach them it's redundant. And if they want to unregister a handler then they can certainly find how to do that somewhere else. And maybe I should be doing something else to kill my spare time than browsing SO and upvoting good questions and answers, downvoting and flagging bad ones, and improve the few posts I can contribute to with the few things I do know. I mean, I intended to genuinely improve an excellent post, it's a bit (quite) irritating to read it's an "incorrect" edit.  I take the [Reject] edits that change an answer's explanation or code, with a supposedly "better" alternative. Even if the proposed solution is better, it should be added as a comment, or a separate answer. guideline as what caused my edit to be rejected. Point is, I was adding information to the answer, not changing or replacing anything.  So, was this edit legit? If I understand  correctly, my edit should have been rejected for changing too much of the post, not for being incorrect or an attempt to comment on the answer. And if Servy's MSO answer is still right, it means I should have posted my content as a brand new answer... to a question that's like 4 years old? , but I find it would have been better to just edit the post, given that "Edits are expected to be substantial and to leave the post better than you found it."  Sorry for the long post.