Highlight Your Xaml - Heres How!-VBForums
Results 1 to 19 of 19

Thread: Highlight Your Xaml - Heres How!

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,381

    Highlight Your Xaml - Heres How!

    As some of you may know, I have been working on a Xaml highlighting engine that produces BB-Code for vBulletin based forums. The ALPHA version was tested by VBNeo, Chris128 and I extensively before moving to BETA. The engine has now been moved to BETA and is available to download here.

    Mendhak has kindly offered to create a webfront and host the x:Light engine which means you now have no excuse not to highlight your Xaml before posting it to the board. Please be aware that both the webfront and the engine are WIP(works in progress) so feel free to PM me if any bugs arise.

    X:Light Web Link

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,598

    Re: Highlight Your Xaml - Heres How!

    Cool the web front end is a good idea.


    Gotta give it a test :P
    Code:
    <Window x:Class="Loginfrm"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Service Desk Logger - Version 1.0.0" Height="208" Width="362" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Name="Loginfrm" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="Transparent" AllowsTransparency="True">
    	
        <Border BorderBrush="Black" BorderThickness="0.8" CornerRadius="8,8,0,0">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF37506B" Offset="0"/>
                    <GradientStop Color="#FF132238" Offset="1"/>
                </LinearGradientBrush>
    All good.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: Highlight Your Xaml - Heres How!

    I think another method to convert it to HTML (so that people can use it in blogs) would be a good future project.


    I've been trying it out a lot and sometimes I get single-line, sometimes multi line. I copied what chris had in his post.

    Code:
    <Window x:Class="Loginfrm"  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  Title="Service Desk Logger - Version 1.0.0" Height="208" Width="362" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Name="Loginfrm" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="Transparent" AllowsTransparency="True">  <Border BorderBrush="Black" BorderThickness="0.8" CornerRadius="8,8,0,0">  <Border.Background>  <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">  <GradientStop Color="#FF37506B" Offset="0"/>  <GradientStop Color="#FF132238" Offset="1"/>  </LinearGradientBrush>
    Last edited by mendhak; Feb 19th, 2009 at 10:05 AM.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,381

    Re: Highlight Your Xaml - Heres How!

    Im working on plans to include a HTML engine but because html is structured the same as xaml the current engine will not do as it will try to highlight the highlight code. Im trying to come up with a way of building one string from another but it is proving harder than I tought.

    Regarding the linebreak issue. That only happens when you copy from the forums it has something to do with the linebreak they use. any suggestions?

  5. #5
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,598

    Re: Highlight Your Xaml - Heres How!

    Yeah that happens when you copy and paste any code that has the "vb" or "vb.net" highlight tag too. Its a right pain in the ass when you want to copy and paste a big chunk of code into VS, as you have to go through and enter each line break in manually.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,381

    Re: Highlight Your Xaml - Heres How!

    I wonder what the code box uses as its newline.

  7. #7
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: Highlight Your Xaml - Heres How!

    Quote Originally Posted by DeanMc
    Im working on plans to include a HTML engine but because html is structured the same as xaml the current engine will not do as it will try to highlight the highlight code. Im trying to come up with a way of building one string from another but it is proving harder than I tought.

    Regarding the linebreak issue. That only happens when you copy from the forums it has something to do with the linebreak they use. any suggestions?
    Debugging... set a breakpoint on the string received. Check to see if you're getting \r\n or just \n or just \r. I'm sure that xLight.dll isn't modifying any newlines but it's possible that it isn't working the other way around. The problem happens the moment you copy from that code box, so maybe you need to look for 'half-line-breaks' and replace them? That of course depends on what is in there.

  8. #8
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,962

    Re: Highlight Your Xaml - Heres How!

    Hey,

    I haven't really played with the XAML side of things yet, but I take it this is done within Visual Studio?!? If so, can you not use this Visual Studio Addin:

    http://www.jtleigh.com/people/colin/...ySourceAsHtml/

    I use it all the time for extracting code from Visual Studio for the purposes of posting into Blogs etc.

    Just a thought.

    Gary

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,381

    Re: Highlight Your Xaml - Heres How!

    You could do that but then A: it wouldn't be on the web, B: you may not be writing in VS and most importantly C: I wouldn't learn anything new.

  10. #10
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,962

    Re: Highlight Your Xaml - Heres How!

    Quote Originally Posted by chris128
    Yeah that happens when you copy and paste any code that has the "vb" or "vb.net" highlight tag too. Its a right pain in the ass when you want to copy and paste a big chunk of code into VS, as you have to go through and enter each line break in manually.
    What browser are you using?

    I have found that this happens if you are using FireFox 3.0.6, but if I use Internet Explorer 7 or Chrome, this doesn't happen.

    Gary

  11. #11
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,962

    Re: Highlight Your Xaml - Heres How!

    Quote Originally Posted by DeanMc
    You could do that but then A: it wouldn't be on the web, B: you may not be writing in VS and most importantly C: I wouldn't learn anything new.
    Dean, I didn't mean any offence, I was just suggesting that CSAH could be used to get the HTML equivalent of the XAML markup. If nothing else, you can look at how it achieved it as the Source Code is available.

    Gary

  12. #12
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,598

    Re: Highlight Your Xaml - Heres How!

    I'm using IE 7 and sometimes Opera 10 and it seems to happen in both as far as I can recall
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  13. #13
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,962

    Re: Highlight Your Xaml - Heres How!

    Strange...

    Anyways, as a work around, you might want to try the following:

    http://www.vbforums.com/showthread.php?t=543154

    Gary

  14. #14

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,381

    Re: Highlight Your Xaml - Heres How!

    I know ya didn't dont panic. It takes a lot to get me offended.

  15. #15

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,381

    Re: Highlight Your Xaml - Heres How!

    Quote Originally Posted by mendhak
    Debugging... set a breakpoint on the string received. Check to see if you're getting \r\n or just \n or just \r. I'm sure that xLight.dll isn't modifying any newlines but it's possible that it isn't working the other way around. The problem happens the moment you copy from that code box, so maybe you need to look for 'half-line-breaks' and replace them? That of course depends on what is in there.
    Quite right it just assumes they are there. I will look into this one today so!.

  16. #16
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,598

    Re: Highlight Your Xaml - Heres How!

    bump because this is useful and more people should see it (I used it just 5 minutes ago! )
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  17. #17

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,381

    Re: Highlight Your Xaml - Heres How!

    I'll ask Mendhak for a sticky!

  18. #18
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,598

    Re: Highlight Your Xaml - Heres How!

    good idea maybe it could replace the one thats currently up there that just asks people to be patient as we dont know everything about WPF (if they arent keen on having any more stickies I mean)
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  19. #19

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,381

    Re: Highlight Your Xaml - Heres How!

    I've pm'ed a list that should clean it up a bit

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.