2016-11-30 1 views
0

RelativeLayout.XConstraint을 특정 플랫폼 값으로 가져오고 싶습니다. 또한 OnPlatform 키워드로 xaml에서이 작업을 수행하려고합니다. 내가 운이없는이 일을 시도 ,플랫폼 별 RelativeLayout.XConstraint를 XAML로 만들려면 어떻게해야합니까?

<RelativeLayout> 
    <RelativeLayout.XConstraint> 
     <OnPlatform x:TypeArguments="Constraint" Android="{ConstraintExpression Type=Constant,Constant=6" iOS="{ConstraintExpression Type=Constant,Constant=3}" /> 
    </RelativeLayout.XConstraint> 
</RelativeLayout> 

그리고 또한이 하나 https://forums.xamarin.com/discussion/57281/how-can-i-make-platform-specific-relativelayout-xconstraint-in-xaml을 시도했지만 "해결 못하는 루프를 포함 지정된 제약"그것은 예외를 보이고있다.

여기 RelativeLayout.XConstraint 또는 다른 접근 방식에 대한 x:TypeArguments은 무엇입니까? 이것에 대한 어떤 힌트/제안을 고대합니다.

답변

2

RelativeLayout에 제약 조건을 적용하고 있지만 제약 조건은 레이아웃 항목에 적용됩니다.

<RelativeLayout> 
    <Label Text="Foo"> 
    <RelativeLayout.XConstraint> 
     <OnPlatform x:TypeArguments="Constraint" Android="{ConstraintExpression Type=Constant,Constant=6}" iOS="{ConstraintExpression Type=Constant,Constant=3}" /> 
    </RelativeLayout.XConstraint> 
    </Label> 
</RelativeLayout> 

또한, 첫 번째 ConstraintExpression 마크 업에 닫는 중괄호 (})을 놓치고있어.

나는 이것을 시험해 보았는데, XamlC를 끄면 잘 작동한다. XF 2.3.3을 실행중인 경우 https://bugzilla.xamarin.com/show_bug.cgi?id=48242이 될 수 있지만 수정본이 존재하고 (https://github.com/xamarin/Xamarin.Forms/pull/580) 향후 서비스 릴리스의 일부로 릴리스 될 예정입니다.

+0

Stephane Delcroix 나는 이것을 시험해 보았지만 행운이 없었다. 상수 값은 XConstraint/YConstraint에 대해서는 반영되지 않습니다. [YConstraint 레이블이 화면 맨 위로 이동 한 경우] 저는 xamarin 양식 버전 2.3.2.127을 사용하고 있습니다. 이 문제에 대한 업데이트가 더 있습니까? – Suchith

+0

xamal 미리보기에서 잘 보이고 있습니다. – Suchith

+0

XF 2.3.3의 최신 서비스 릴리스 테스트 –

관련 문제