Path Data, Prefixes and Known Colors

I previously wrote about some fixes I made to the Baml Viewer addin for Reflector. As always happens with these kinds of things, one thing led to another and I ended up finding a few more issues and felt compelled to debug/fix them. Tonight I checked in a few more changes:

  • Xml Namespace Mapping Prefixes – While debugging the first set of issues I noticed that the xml namespace mappings weren’t being included. So when a type name was displayed it excluded the prefix – e.g. ButtonChrome instead of theme:ButtonChrome.
  • PathData – A reader posted a comment mentioning that path data was always displayed as “???”. I guess this was a placeholder but the functionality was never implemented. This was a bit involved but the baml viewer will now display the path markup notation for the path data geometry. Note, the original value won’t necessarily round trip to the exact original markup but the resulting path should be the same. So if you used m (for a relative move) instead of M (for an absolute move), you may notice that M is output instead. The absolute points were likely calculated when the original path markup was parsed so the output will contain M (i.e. absolute offsets) and the points will be absolute instead of relative.
  • Known Colors – Solid color brush values are handled specially by the baml compiler. Previously the only known color that was handled was transparent. All other known colors were output using their ARGB values – incidentally without the leading # so if you tried to use the xaml it would give you an error. The baml viewer will now map these known colors back to the known color name.

I hope I don’t find any more issues :-) but if you find something interesting I may try to look into it as time allows.

About these ads

12 Responses to “Path Data, Prefixes and Known Colors”

  1. Thomas Says:

    hi andrew,

    No other issues, but when are your changes online?
    The current version : Last edited Mar 11 2007 at 1:05 AM by lutzroeder, version 4
    ?

  2. agsmith Says:

    Sorry I only checked it in so you would have had to download the source and the changeset and build it. I updated the download page with the latest build.

  3. Alex Simkin Says:

    Thank you very very much for Path.Data – you are the best ! :)

  4. Duy Doan Says:

    Hi Andrew,
    You made this add-in more useful with Path Data. I found minor issues, please take a look when you have free time.

    1. Real xaml:

    In baml viewer there only:

    2. Real xaml:

    In baml viewer:
    ==> causing Foreground not found in ContentPresenter

    Cheers,
    Duy

  5. Duy Doan Says:

    Oops i don’t know why xaml code auto deleted after posting
    1. Real xaml:
    //
    //
    //
    In baml viewer there only:
    //
    //

    2. Real xaml:
    //
    In baml viewer:
    // ==> causing Foreground not found in ContentPresenter

    Cheers,
    Duy

  6. agsmith Says:

    Sure I can look at it but the xaml was lost so I can’t see the original & outputted xaml. It seems that WordPress is losing any xml posted in the comments.

  7. agsmith Says:

    Try downloading this file and run the xaml through it and use the resulting html instead. You’ll have to remove the .doc extension.

  8. Yasser Says:

    Andrew, thanks for this. I remember spending a ton of time fixing all the little mistakes in the resulting code prior to this, and it probably would’ve been better for me to just try to fix the plugin. I think it’s great, but there’s only one thing that I see it’s missing and that’s the starting class tag for xaml files. Here’s what I mean:

    This is the original code:

    <Window x:Class="TestProject.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml&quot;
        Title="MainWindow" Height="300" Width="300">
        <Grid>
            
        </Grid>
    </Window>

    This is after being extracted from the binary by bamlviewer:

    <MainWindow 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&nbsp;
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&nbsp;
        Title="MainWindow" Height="300" Width="300">
        <Grid />
    </MainWindow>
     

    Notice how the first line is missing the base class Window, and the x:Class definition for this new class? It becomes more apparent if that class has resources, they are declared as:

        <MainWindow.Resources>
        </MainWindow.Resources>

    and not Window.Resources like it should.

    Lastly, when trying to build the source I’ve noticed that it’s referencing to build the using the .NET 1.0 csc.exe. I’ve got a clean PC that only
    has VS 2008 w/ sp1 installed and it seems that microsoft is no longer including the 1.0 csc so I couldn’t build. As a fix on my end I went through the .csproj and .sln files in notepad and replaced all the .NET 1.0 with .NET 2.0 then it all builds fine. Any reason why the 1.0 compiler is still being used for this?

    Thanks again! This really comes in handy.

  9. agsmith Says:

    Yasser, sorry for the late approval/reply – for some reason I didn’t get a notification for the comment post. Anyway, I’ll put that on the list of things that need to be addressed but I can’t say when/if I will actually get to it. I would love to get to full round tripping but there are lots of things that need to be addressed. Considering WPF 4 seems like it will have a baml processor I’m not sure how much it is worth the effort but I’ll keep it on my list should I get the time.

  10. Terry Clancy Says:

    Regarding relative Path Markup Notation as described here http://msdn.microsoft.com/en-us/library/ms752293.aspx .

    Using the Path Markup Syntax you enter each command by using either an uppercase or a lowercase letter: uppercase letters denote absolute values and lowercase letters denote relative values: the control points for that segment are relative to the end point of the preceding example. Using this Syntax I have created the following Path Geometry.

    However I want the Starting Point (100,100 in this example) to be databound as I want to start it at a point which I calculate to be the center of the .

    I assume to do this I can either Databind the entire Figures string or cease using the abbreviated Path Markup Syntax and define the in explicit XAML.

    So I am trying to define the in explicity XAML and here is my question:

    QUESTION: In defining the above in explicit XAML, how do I specify the use of relative values, or offsets, ie for example that the control points for that segment are relative to the end point of the preceding example.

  11. Tatiana Binegar Says:

    One can imagine I read it twice. While I am not as versatile on this issue, I tally with your determinations because they make sense. Thanks and goodluck to you.

  12. estetik Says:

    Sure I can look at it but the xaml was lost so I can’t see the original & outputted xaml. It seems that WordPress is losing any xml posted in the comments.
    63

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: