Geeks With Blogs


What I do:

Identity Mine

MVVM Light


What I am:

Microsoft Most Valuable Professional, Client Application Development

Microsoft Certified Technology Specialist, Windows Presentation Foundation

WPF disciples


View my profile on LinkedIn

Creative Commons License
Diary of a Code Trotter by Laurent Bugnion is licensed under a Creative Commons Attribution 3.0 Unported License

All source code on this blog is licensed under the MIT license.

Copyright (c) 2006 - 2011 GalaSoft Laurent Bugnion

Laurent Bugnion (GalaSoft) Diary of a Code Trotter
I reached my goal for today, which was to implement the Image element. So now my blog control can display: Date, Title, Text, Frame, List, Image. The last one I still need to write is a small element displaying a thumbnail banner. Since thumbnails are made actually images, I can reuse my method, so it should be fast.
I reworked the XSD schema, because the Image element was really too simple in the last version. I extended it with a Link, a Target for the link, and a ALT attribute, which is also used for the TITLE of the image. I made a type with this Image element, in order to re-use it for thumbnails. Also, I used enumerations for the Target element, in order to enumerate the _self, _top, _blank and _parent targets. Additionally, the target can be any name starting with a literal character, so I defined a union between this enumeration and a regular expression (pattern). That was fun.
<xs:complexType name="Image"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="link" type="xs:string" minOccurs="0" maxOccurs="1" /> <xs:element name="link-target" minOccurs="0" maxOccurs="1"> <xs:simpleType> <xs:union> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="_blank" /> <xs:enumeration value="_top" /> <xs:enumeration value="_self" /> <xs:enumeration value="_parent" /> </xs:restriction> </xs:simpleType> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="[a-zA-Z].+" /> </xs:restriction> </xs:simpleType> </xs:union> </xs:simpleType> </xs:element> <xs:element name="alt-title" type="xs:string" minOccurs="0" maxOccurs="1" /> <xs:element name="legend" type="xs:string" minOccurs="0" maxOccurs="1" /> </xs:choice> <xs:attribute name="path" type="xs:string" use="required" /> </xs:complexType>
Extract of the XSD file: The Image type
Blog entry: XSD Schema
Blog entry: XSD Schema
If everything goes well tomorrow evening, I'll be able to post a demo page before this weekend, and then to work on integrating the control in my main webpage and in my PhotoAlbum.
Posted on Tuesday, June 27, 2006 8:46 PM Technical stuff , .NET , Website , ASP.NET 2.0 | Back to top

Comments on this post: RealSimpleBlog custom control (V0.1): Day 5

# re: RealSimpleBlog custom control (V0.1): Day 5
Requesting Gravatar...
Wow - nice work!
Left by Hal on Jun 28, 2006 6:22 AM

# re: RealSimpleBlog custom control (V0.1): Day 5
Requesting Gravatar...
Thanks Hal. I will probably post examples and demo of the RealSimpleBlog control these next days. The goal is to distribute the control open source, as soon as V1 is finished. Stay tuned ;-)
Left by Laurent on Jun 28, 2006 6:58 AM

Comments have been closed on this topic.
Copyright © Laurent Bugnion | Powered by: