Simple Styles

Control templating in Avalon is super powerful, but can be tough to get right.  There is a lot of minutae to keep track of to build a control template that works correctly.  This is especially true for some of the more complex controls (like Menu or ComboBox).

In an attempt, then, to give you a better starting point, I’ve put together a handful of “simple” styles.  Simple for two reasons: first is a simple design aesthetic—these are designed with the idea that they are a base for your own design kung-fu.  They are also simple in implementatio—I’ve minimized the unnecessary goo so it should be easier to see what’s going on. 

You can get them here.  Right now, I’ve only tackled the most common controls.  More will be coming though.  Chime in if you have requests. 

10 Responses to “Simple Styles”

  1. Don Says:

    Is it me, or did you not post the actual styles/link?

  2. Robby Says:

    Looks like I forgot to include a link. Just updated the entry with a link. Incidentally, I haven’t actually tested these against the public beta that they target. They compile against those bits but the strange configuration of my machine keeps me from actually running the app. If someone could confirm to me that these work as expected, I would be most appreciative.

  3. Valentin Iliescu Says:

    When I try to run the example I get this error:
    “The StaticExtension value ‘MenuItem.TopLevelItemTemplateKey’ cannot be resolved to an enum, static field or static property.”

  4. Valentin Iliescu Says:

    Me again :)
    I have commented out the styles for the MenuItem, now I get another error at runtime:
    “Invalid value ” for property ‘IsChecked’.”

  5. Valentin Iliescu Says:

    I have tried to run the sample but there are too many errors. I have tried to comment out the styles that were raising errors but other errors showed up.
    Are you sure that the sample is for the public Beta 1 and not for a later build? For example, “Stylus.IsFlicksEnabled” is used as a dependency property in your sample but I couldn’t find it in the WinFX documentation or in Intellisense.

    Regards,
    Valentin

  6. Don Says:

    While they do compile, they don’t run, the first error I have received so far:

    The StaticExtension value ‘MenuItem.TopLevelItemTemplateKey’ cannot be resolved to an enum, static field or static property.

    I’ll try to mess around a bit with it to see if its a simple problem.

  7. Don Says:

    OK, So it seems on ALL of the menuitem styles, that your keys are causing the error, after changing those, the latest error is that IsChecked cannot be set to {x:Null}.

    Next is a problem with IsKeyboardFocusWithin not being a DependencyProperty for ComboBox.

    OK, after a TON of changes, I finally got it to compile, doubt I can paste it into here, but I’ll give it a shot…keep in mind, that not everything looks as though it works right, probably as I had to just comment a few things out, as my goal at this time was just to get it to compile, looks like it has good potential to be quite helpful, especially if these bugs can be worked out.

    [REMOVED: Don’s changes–only about half the file made it into the comment. Don, could email these to me and I’d be happy to post them.]

  8. Don Says:

    Oops, I incidentally through a TextBlock with x:Name=”TextBoxContent”, it is a child of ScrollViewer, it should be removed & the x:Name of the ScrollViewer should have the x:Name set to TextBoxContent instead. (Cool effect though)

  9. Robby Says:

    Sorry for all of the errors with these. These were backported to Beta1 from the current internal build and I cleary didn’t get all of the breaking changes. Don, could you email your changes? I’ll try to have something that works up as soon as possible.

  10. Don Says:

    Would love to, but don’t seem to see your email address anywhere, if you send me an address I’ll reply with the fixed code. (driggins at vcgsoftware.com)

Leave a Reply