﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - Crosslight - Crosslight ListView Styling</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Crosslight-ListView-Styling/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Crosslight ListView Styling</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Crosslight-ListView-Styling/</link><pubDate>Mon, 22 Dec 2014 01:35:17 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;blockquote&gt;What I want to achieve is setting the background color of selected list items programmatically at runtime. On iOS this seems to work quite easy by setting "this.Appearance.CellSelectedBackgroundColor = UIColor.Green;" as you described. Is there a similar way on Android, too?&lt;/blockquote&gt;&lt;p&gt;&lt;span style="color: #1f497d;"&gt;I'm afraid that there is no similar way on Android. You will need to do the styling via cell templates and xml.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Crosslight ListView Styling</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Crosslight-ListView-Styling/</link><pubDate>Thu, 18 Dec 2014 15:51:12 GMT</pubDate><dc:creator>thomas.albert@tea-net.ch</dc:creator><description>&lt;p&gt;Hello Yudi,&lt;/p&gt;&lt;p&gt;doing all the styling at design time via templates and xml works. This is no problem.&lt;/p&gt;&lt;p&gt;But what about styling in code as I described above? &lt;/p&gt;&lt;p&gt;How can I understand your answer? Haven't you figured out how to do it yet or is it not possible at all to do this?&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Thomas&lt;br&gt;&lt;/p&gt;</description></item><item><title>Crosslight ListView Styling</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Crosslight-ListView-Styling/</link><pubDate>Thu, 18 Dec 2014 07:32:34 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="color: #1f497d;"&gt;For your information, I can use following snippet code to change button's background color (on a simple Android layout) at runtime.&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;protected override void InitializeView()
{
    base.InitializeView();

    Button btnSendFeedback = FindViewById&amp;lt;Button&amp;gt;(Resource.Id.SendFeedbackButton);
    btnSendFeedback.SetBackgroundColor(Color.Red);
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;However, I haven't managed to get the same approach working for customizing item style of custom cell template scenario. In the meantime, you can try to use the &lt;em&gt;custom cell template&lt;/em&gt; way to set the style of listview items for Android platform.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Crosslight ListView Styling</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Crosslight-ListView-Styling/</link><pubDate>Tue, 16 Dec 2014 05:50:17 GMT</pubDate><dc:creator>thomas.albert@tea-net.ch</dc:creator><description>&lt;p&gt;Any news?&lt;br&gt;&lt;/p&gt;</description></item><item><title>Crosslight ListView Styling</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Crosslight-ListView-Styling/</link><pubDate>Thu, 11 Dec 2014 11:06:02 GMT</pubDate><dc:creator>thomas.albert@tea-net.ch</dc:creator><description>&lt;p&gt;Hello Yudi,&lt;/p&gt;&lt;p&gt;Thank you for your answer. I think my original question was not precise enough to describe my problem. Sorry for that.&lt;/p&gt;&lt;p&gt;What I want to achieve is setting the background color of selected list items programmatically at runtime. On iOS this seems to work quite easy by setting "this.Appearance.CellSelectedBackgroundColor = UIColor.Green;" as you described. Is there a similar way on Android, too?&lt;/p&gt;&lt;p&gt;With a similar mechanism I would like to set the style of the text within a cell template. So&amp;nbsp;commands like "this.Appearance.CellTextColorOfText1 = UIColor.Red" or "this.Appearance.CellFontWeightOfText1 = FontWeight.Bold"&amp;nbsp;would be great (for both iOS and Android).&lt;/p&gt;&lt;p&gt;These commands should then work with the built-in cell templates as well as with custom cell templates.&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Thomas&lt;br&gt;&lt;/p&gt;</description></item><item><title>Crosslight ListView Styling</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Crosslight-ListView-Styling/</link><pubDate>Tue, 09 Dec 2014 07:29:40 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Customizing cell template technique can be used to implement this scenario, to set the style of listview items at runtime (setting the color of texts of a list item and setting the color of the list selector).&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #1f497d;"&gt;&lt;strong&gt;Create custom cell template for iOS UITableView&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #1f497d;"&gt;You can customize the appearance and presentation of cell template in a table view for iOS to match your business requirement. Your apps look better when the cell template are presented more intuitively, for instances, setting the color of label to a TableViewCell.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color: #1f497d;"&gt;A how-to article, &lt;a href="http://developer.intersoftpt.com/display/crosslight/Create+Custom+Cell+Template+for+iOS+UITableView" target="_blank"&gt;Create Custom Cell Template for iOS UITableView&lt;/a&gt;, will guide you to customize the appearance of cell template. After adding a label (in step: Create View for Custom Cell Template), you can change the textColor property of UILabel via Interface Builder.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Set the color of the list selector in iOS can be done by set the &lt;em&gt;CellSelectedBackgroundColor&lt;/em&gt; property in OnInitializeView of the relevant view controller. The snippet code below shows how.&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;protected override void InitializeView()
{
    base.InitializeView();

    this.Appearance.CellSelectedBackgroundColor = UIColor.Green;
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;We can use DataSamples project and implement the above snippet code in SimpleListViewController.cs. The result will look like following screenshot.&lt;/span&gt;&lt;/p&gt;
&lt;img src="http://www.intersoftpt.com/Community/Attachments/4263/iOS_CellSelectedBackgroundColor.png" style="height: 428px; width: 297px;"&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;&lt;strong&gt;Create custom cell template for Android&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;The steps to create custom cell template for Android is simple. First, we'll need to create view for custom cell template. For example:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&amp;lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="10dp"
    android:minHeight="75dp"&amp;gt;
    &amp;lt;LinearLayout
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:orientation="vertical"
        android:layout_weight="1"&amp;gt;
        ...
        &amp;lt;TextView
            android:text="Label"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="right"
            android:paddingRight="10dp"
            android:id="@+id/PriceLabel" /&amp;gt;
    &amp;lt;/LinearLayout&amp;gt;
    &amp;lt;ImageView
        android:id="@+id/ImageView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="5" /&amp;gt;
&amp;lt;/LinearLayout&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Next, override ListItemLayoutId in activities that consumes the custom cell template. Simply pass in the layout that represents the custom cell template.&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;protected override int ListItemLayoutId
{
    get { return Resource.Layout.CustomTableCell; }
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;To set the color of text of a list item can be done by defining textColor of TextView (for example: android:textColor="#00FF00")&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;The result will look like following:&lt;/span&gt;&lt;/p&gt;
&lt;img src="http://www.intersoftpt.com/Community/Attachments/4263/Android_CustomCellTemplate.png" style="height: 382px; width: 280px;"&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Hope this help.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Crosslight ListView Styling</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Crosslight-ListView-Styling/</link><pubDate>Fri, 05 Dec 2014 14:24:05 GMT</pubDate><dc:creator>thomas.albert@tea-net.ch</dc:creator><description>&lt;p&gt;Hello Support,&lt;/p&gt;&lt;p&gt;is there a way how I can set the style of listview items at runtime. With style I mean, setting the color of texts of a list item and setting the color of the list selector.&lt;/p&gt;&lt;p&gt;An example for iOS and Android would be great.&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Thomas&lt;br&gt;&lt;/p&gt;</description></item></channel></rss>