More MoXAML

As promised, MoXAMLPowerToys is being enhanced and updated. To this end, I’ve been hard at work tidying up the code and responding to the comments raised in the original post.

The original code has been heavily rejigged to make it easier for me to add new features and in the process I’ve added a new power toy; now it’s simple to convert an automatic property to use INotifyPropertyChanged. All you need to do is pick the property in the code window and select Notify Property (C# Only), and it will add the necessary plumbing.

Cunningly enough, it adds the Changed method if it’s not already present. ;->

Notify Property in action:

After the command:

Download

You can download the latest source (and a setup) here. (Please redownload this package, I’ve updated the setup project to move the application Addin file into the Addins directory, and to point it to the installation folder as a custom action).

Source moved here.

As always, keep your comments coming in and let me know what else you’d like to see – and while you’re at it, don’t forget to download the original XAMLPowerToys.

About these ads
  1. September 17, 2008 at 6:16 pm | #1

    great work! This looks like it’ll be a really good timesaver.

  2. peteohanlon
    September 17, 2008 at 6:41 pm | #2

    Thanks Alan. I hope it helps.

  3. Jeremy Robertson
    September 18, 2008 at 9:07 pm | #3

    Email me your e-mail address. I added a command that I find very useful and I’d let to send it to you in case you want to add it in with your stuff.

    This is fantastic code to see. I’ve been wanting to make an add-on for some time and this was just what I needed to get myself to do it.

  4. September 30, 2008 at 8:31 pm | #4

    Hey Pete, I’ve got an idea for another MoXAML timesaver: automating the creation of a DependencyProperty.

    I envision selecting from the MoXAML menu what type you want (normal, attached, attached read-only, etc.), which will prompt you for a name, eg. “HighlightBrush”, and a type (“Brush”), and default value (“Brushes.Blue”) and will generate the following line:

    public static readonly DependencyProperty HighlightBrushProperty = DependencyProperty.Register( “HighlightBrush”, typeof( Brush ), typeof( ), new PropertyMetadata( Brushes.Blue, DependencyPropertyChanged ) );

    as well as the DependencyPropertyChanged method (that doesn’t necessarily have to do anything, but gives the user a quick and hooked-up spot to add functionality).

    If you really wanted to go the extra mile you could even generate a HighlightBrushChanged event and hook it up in the static DependencyPropertyChanged method like so:

    private static void DependencyPropertyChanged( DependencyObject sender, DependencyPropertyChangedEventArgs e ) {
    ( ()sender ).OnHighlightBrushChanged( e );
    }

    …which would also involve generating the HighlightBrushChanged event and OnHighlightBrushChanged:

    public event DependencyPropertyChanged HighlightBrushChanged;
    internal void OnHighlightBrushChanged( DependencyPropertyChangedEventArgs e ) {
    if ( HighlightBrushChanged != null )
    HighlightBrushChanged( this, e );
    }

    … tall order I know. :)

  5. September 30, 2008 at 8:33 pm | #5

    whoops there were a few things wrapped in angle brackets that disappeared (you think i’d learn not to do that, argh) that were supposed to say <current class>

  6. September 30, 2008 at 8:36 pm | #6

    You’re reading my mind here Logan. That’s on my wishlist right now.

    Just wait until you see the next version – the AppWizard in it is cool. It’s taking a lot of coding, but it’s going to be worth the wait (I hope).

  7. October 1, 2008 at 1:31 am | #7

    Cool! There’s definitely a great deal of room for optimizing the WPF development process. Looking forward to what you come up with next!

  8. peteohanlon
    October 1, 2008 at 8:07 am | #8

    Logan – part of what I’m trying to do with the Power Toys is reduce the amount of boilerplate code that we have to type.

    Karl’s PowerToys are a huge step in this direction because they make them so simple to generate business forms, which is about 90% of what most companies will look to do. I can’t, and shouldn’t, try to compete with that, so I’m trying to fill in the bits that surround it – the bits that I always wish there was an easier way to do.

    OK – that sounded preachy. It’s not meant to be – it’s just a quick overview of the ethos behind MoXAML. Now, if only I could come up with a cool codename for it. Karl’s got Ocean and Hawaii – I don’t really want to go with North Sea or Scilly Isles.;->

  9. October 4, 2008 at 3:12 am | #9

    Lol, how ’bout Loch Ness or Nessie? ;)

  1. September 17, 2008 at 6:21 pm | #1
  2. September 29, 2008 at 6:58 am | #2

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.

Join 40 other followers

%d bloggers like this: