2017-05-03 6 views
0

カラム定義のwidthプロパティをバインドしようとしていますが、バインディングを取得できないようです。誰もXamarin Gridの列定義をプロパティにバインドする方法を教えてもらえますか?カスタムクラスでXamarinはColumnDefinition Widthプロパティにバインドします。

バインディングプロパティ:これは私の財産です

public static readonly BindableProperty PointsColumnsProperty = BindableProperty.Create(nameof(PointsBarColumns), typeof(ColumnDefinitionCollection), typeof(RewardsPanel), new ColumnDefinitionCollection()); 

は:バインディングを

_pointsBar.ColumnDefinitions[0].SetBinding(ColumnDefinition.WidthProperty, nameof(PointsFill)); 

答えて

0

私が行方不明になった:

public GridLength PointsFill { 
    get => (GridLength)GetValue(PointsFillProperty); 
    set => SetValue(PointsFillProperty, value); 
} 

これは私が設定してい結合方法です_pointsBarのコンテキスト。

 _pointsBar = new Grid 
     { 
      BackgroundColor = BasicStyle.PrimaryColor, 
      Style    = BasicStyle.PointsAndVisits, BindingContext = this, 
      ColumnDefinitions = 
      { 
       new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, 
       new ColumnDefinition { Width = new GridLength(100, GridUnitType.Star) } 
      } 
     }; 
関連する問題