2016-10-18 111 views
1

我使用下面的XAML代码来呈现在ListView一些数据:是否可以绑定RelativeLayout约束?

<ListView x:Name="myListView" 
      ItemsSource="{Binding myData}" 
      RowHeight="230"> 
    <ListView.ItemTemplate> 
     <DataTemplate> 
     <ViewCell> 
      <ViewCell.View> 
      <RelativeLayout Padding="1"> 
       <StackLayout x:Name="stackLayoutTitle" 
          Padding="5" 
          Orientation="Vertical" 
          VerticalOptions="EndAndExpand" 
          RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width}" 
          RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.6}"> 
       <Label Text="{Binding myText}" 
         FontSize="Medium" 
         FontAttributes="Bold" 
         TextColor="Black"> 
       </Label> 
       </StackLayout> 
      </RelativeLayout> 
      </ViewCell.View> 
     </ViewCell> 
     </DataTemplate> 
    </ListView.ItemTemplate> 
    </ListView> 

的数据被渲染确定。现在,我想要做的是对RelativeYConstranit的Factor属性使用banding来根据一些计算来定位相应的StackLayout。这样东西(见因子属性):

RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor={Binding someValue}}" 

但是,在运行应用程序时,我得到一个错误。

有没有人知道是否有可能使用绑定表达式呢?

感谢。

回答

0

我有这个问题。 “因素”不是BindingProperty。因此现在是不可能的。

相关问题