カスタムレンダラーなしでXamarin.Formsリストビュー(またはセル)をカスタマイズする方法はありますか?ネイティブレンダラーのないリストビューをカスタマイズする
私が見つけたすべての結果は、ネイティブレンダラで説明されていますが、私が望むものではありません。
共有プロジェクトのPCLからListViewのセルをカスタマイズし、Xamarin.Formsの機能を維持し、アプリケーション間のすべてのUIコードを共有したいだけです。
EDIT 1:
public class TappticCell : ViewCell
{
#region BindableProperty Fields
public static readonly BindableProperty NameProperty =
BindableProperty.Create("Name", typeof(string), typeof(string), "");
public static readonly BindableProperty NameColorProperty =
BindableProperty.Create("NameColor", typeof(Color), typeof(Color), Color.Transparent);
#endregion
#region BindableProperty Properties
public string Name
{
get { return (string)GetValue(NameProperty); }
set { SetValue(NameProperty, value); }
}
public Color NameColor
{
get { return (Color)GetValue(NameColorProperty); }
set { SetValue(NameColorProperty, value); }
}
#endregion
#region Fields
private readonly Label _nameLabel;
private readonly StackLayout _stackLayout;
#endregion
#region Constructors
public TappticCell()
{
[...]
_nameLabel = new Label { HorizontalOptions = LayoutOptions.CenterAndExpand };
_nameLabel.SetBinding(Label.TextProperty, "Name");
_nameLabel.SetBinding(Label.TextColorProperty, "NameColor");
[...]
}
#endregion
}
私の問題は、XAML
<cells:TappticCell Image="{Binding Image}"
Name="{Binding Name}"
BackgroundColor="Gray"
NameColor="{Binding Favorite, Converter={StaticResource BooleanToColor}}"
TextSize="30" />
私はImageCellでこれを使用しての私の使用ここでは... BindableProperty NameColorを有する第二SetBindingが動作しないですそれは素晴らしいですが、私のカスタムセルではありません...
ありがとう
XAMLやコードでやりたいですか? 'ListView.ItemTemplate'を見てください –