1

monotouch.dialog を使用してカスタム エントリ要素を作成しようとしています。StringElement をサブクラス化して独自の文字列要素のスタイルを設定する方法を理解しています - 以下の例を参照してください。

public class CustomStyledStringElementPlain : MonoTouch.Dialog.StyledStringElement
{
    public CustomStyledStringElementPlain (string _caption, UIColor _backgroundcolour, UITextAlignment _alignment) : base(string.Empty,string.Empty)
    {
        TextColor = UIColor.White;
        Font = UIFont.FromName ("Helvetica-Bold", 14f);
        Caption = _caption;
        Alignment = _alignment;
        BackgroundColor = _backgroundcolour;
    }
}

ただし、EntryElement をサブクラス化すると、たとえば、BackgroundColor のプロパティにアクセスできません (これが主に変更したいことです!) これまでのところ、次のようなものがあります...背景色またはその他のスタイルのエントリ要素は大歓迎です!

public class CustomStyledEntryElementPlain : MonoTouch.Dialog.EntryElement
{
    public CustomStyledEntryElementPlain (string _caption, UIColor _colour, UITextAlignment _alignment) : base(string.Empty,string.Empty)
    {
        ReturnKeyType = UIReturnKeyType.Done;
        Caption = _caption;
    }
}
4

1 に答える 1

1

MonoTouch.Dialog Element をカスタマイズするには、GetCell メソッドをオーバーライドして、セル オブジェクトに必要な外観を設定します。このようなもの:

public override UITableViewCell GetCell(UITableView tableView) {
    var cell = base.GetCell(tableView);
    cell.BackgroundColor = _colour;
    return cell;
}
于 2013-03-28T08:10:52.677 に答える