I'll start by explaining what I'm trying to do:
I want to make a custom ItemEntry-based class/widget that I can use in an ItemListbox to display some simple information about map layer objects in our program. My MapLayerItemEntry should have a toggle button and a few text fields. Pretty simple stuff. The text fields include the name of the map layer and a brief description.
I'm hung up on the looknfeel. What I have right now is this:
Code: Select all
<!--
***************************************************
Immersive_Border/MapLayerItemEntry
***************************************************
-->
<WidgetLook name="Immersive_Border/MapLayerItemEntry">
<PropertyDefinition name="TextColour" initialValue="FF000000" redrawOnWrite="true" />
<PropertyDefinition name="SelectedTextColour" initialValue="FFFFFFFF" redrawOnWrite="true" />
<PropertyDefinition name="SelectionBrush" initialValue="set:Immersive_Border image:StaticBackdrop" redrawOnWrite="true" />
<PropertyDefinition name="SelectionColour" initialValue="FF3030FF" redrawOnWrite="true" />
<Property name="Selectable" value="True" />
<NamedArea name="ContentSize">
<Area>
<Dim type="LeftEdge" >
<AbsoluteDim value="0" />
</Dim>
<Dim type="TopEdge" >
<AbsoluteDim value="0" />
</Dim>
<Dim type="Width" >
<FontDim type="HorzExtent" padding="6" />
</Dim>
<Dim type="Height" >
<FontDim type="LineSpacing" />
</Dim>
</Area>
</NamedArea>
<ImagerySection name="layername">
<TextComponent>
<Area>
<Dim type="TopEdge">
<AbsoluteDim value="0" />
</Dim>
<Dim type="LeftEdge">
<AbsoluteDim value="3" />
</Dim>
<Dim type="RightEdge">
<UnifiedDim scale="1" offset="-3" type="RightEdge" />
</Dim>
<Dim type="BottomEdge">
<UnifiedDim scale="1" type="BottomEdge" />
</Dim>
</Area>
</TextComponent>
</ImagerySection>
<ImagerySection name="description">
<TextComponent>
<Area>
<Dim type="TopEdge">
<AbsoluteDim value="5" />
</Dim>
<Dim type="LeftEdge">
<AbsoluteDim value="3" />
</Dim>
<Dim type="RightEdge">
<UnifiedDim scale="1" offset="-3" type="RightEdge" />
</Dim>
<Dim type="BottomEdge">
<UnifiedDim scale="1" type="BottomEdge" />
</Dim>
</Area>
</TextComponent>
</ImagerySection>
<ImagerySection name="selection">
<ImageryComponent>
<Area>
<Dim type="TopEdge">
<AbsoluteDim value="0" />
</Dim>
<Dim type="LeftEdge">
<AbsoluteDim value="0" />
</Dim>
<Dim type="RightEdge">
<UnifiedDim scale="1" type="RightEdge" />
</Dim>
<Dim type="BottomEdge">
<UnifiedDim scale="1" type="BottomEdge" />
</Dim>
</Area>
<ImageProperty name="SelectionBrush" />
<ColourProperty name="SelectionColour" />
<VertFormat type="Stretched" />
<HorzFormat type="Stretched" />
</ImageryComponent>
</ImagerySection>
<StateImagery name="Enabled">
<Layer>
<Section section="layername">
<ColourProperty name="TextColour" />
</Section>
<Section section="description">
<ColourProperty name="TextColour" />
</Section>
</Layer>
</StateImagery>
<StateImagery name="Disabled">
<Layer>
<Section section="layername">
<ColourProperty name="TextColour" />
</Section>
<Section section="description">
<ColourProperty name="TextColour" />
</Section>
</Layer>
</StateImagery>
<StateImagery name="SelectedEnabled">
<Layer>
<Section section="selection" />
<Section section="layername">
<ColourProperty name="SelectedTextColour" />
</Section>
<Section section="description">
<ColourProperty name="SelectedTextColour" />
</Section>
</Layer>
</StateImagery>
<StateImagery name="SelectedDisabled">
<Layer>
<Section section="selection" />
<Section section="layername">
<ColourProperty name="SelectedTextColour" />
</Section>
<Section section="description">
<ColourProperty name="SelectedTextColour" />
</Section>
</Layer>
</StateImagery>
</WidgetLook>
Basically just the WindowsLook ListboxItem with two ImagerySections with TextComponents instead of one.
I haven't added the togglebutton child yet, but I know how to do that. I also haven't messed with sizing or positioning yet. My question is, how do I access these textcomponents I've made to change the text they display...? Could I somehow set them up to be linked to a property? (Like make it so there's a MapName property and a MapDesc property, and setting the MapName property sets the text in the layername textcomponent, and MapDesc sets description.) How would I do that? If there's a good document that talks all about properties, how to make new ones, etc., that would be helpful; I have difficulty navigating through some of the documents on the CE site and a lot of the XML wiki pages I've read deal with older versions.