2009-06-28, 04:19 PM
Ommina Wrote:Well, maybe I should have said 'disabled' instead of 'unavailable'. I'm looking for a visually distinctive list item that indicates the video is unavailable.Here is one way to accomplish what you want.
It my case, it will represent the name of an episode for which the client does not have a playable file. I can add an icon to the line easily enough, but I would really like to dim the text a little bit. It's fine - in fact preferred - if it is still selectable (so unlike 'disabled' in that respect).
As I type this, I wonder if I could use a @textStyle property, although that would still be taking the colour choices out of the skin and into the plugin, which I find somewhat distasteful. Hmmm.
In your skin, create text styles for list item test, avail and unavail.
Code:
<TextStyles>
<TextStyle name="ListAvailableTextStyle" color="White" size="12"/>
<TextStyle name="ListUnavailableTextStyle" color="Gray" size="12"/>
</TextStyles>
For you list item composite images, define the textStyle element as a variable.
Code:
<CompositeImage name="ListBoxListNormal" size="20.0,4.5">
<DrawCommonImage name="ListViewNormalItemBackground"/>
<DrawText text="@text" loc="0,0" size="100,100" textStyle="@[B]ListItemTextStyle[/B]" align="Left" valign="Center"/>
</CompositeImage>
<CompositeImage name="ListBoxListSelected" size="20.0,4.5">
<DrawCommonImage name="ListViewSelectedItemBackground"/>
<DrawText text="@text" loc="0,0" size="100,100" textStyle="@[B]ListItemTextStyle[/B]" align="Left" valign="Center"/>
</CompositeImage>
<CompositeImage name="ListBoxListSelectedInactive" size="20.0,4.5">
<DrawCommonImage name="ListViewSelectedInactiveItemBackground"/>
<DrawText text="@text" loc="0,0" size="100,100" textStyle="@[B]ListItemTextStyle[/B]" align="Left" valign="Center"/>
</CompositeImage>
In your code, as you build each item. assign the appropriate textStyle name to each of the items. In this case, any item with a 'c' in it will be marked 'unavailable'.
Code:
[SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]WizUiList[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]WizListItem[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] item = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]WizUiList[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]WizListItem[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]();[/SIZE]
[SIZE=2]item.AddProperty([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"@text"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], words[i]);[/SIZE]
[SIZE=2]item.AddProperty([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"@tag"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"Word number "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + (i + 1) + [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]" in the paragraph"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (words[i].ToLower().IndexOf([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"c"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) > -1)[/SIZE]
[SIZE=2] item.AddProperty([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"@[B]ListItemTextStyle[/B]"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"[B]ListUnavailableTextStyle[/B]"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2] item.AddProperty([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"@[B]ListItemTextStyle[/B]"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"[B]ListAvailableTextStyle[/B]"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2]itemList.Add(item);[/SIZE]
Attached is a full example of the working code...