您好,我正在 .net maui 中創建一個表單,當輸入具有特定值時,我希望某些元素不可見。
我嘗試了以下方法,但它不起作用,我正在努力尋找任何在 xaml 中提到行內 if 陳述句的檔案。
<Picker x:Name="pickerMajor"
TextColor="Black"
MinimumWidthRequest="900"
ItemsSource="{Binding Major}"
ItemDisplayBinding="{Binding SubjectCode}"
SelectedItem="{Binding SelectedSubjectMajor}"
IsVisible="StudentDetail.StudentType == "Diploma" ? false : true"
/>
uj5u.com熱心網友回復:
StudentDetail.StudentTypexaml 中的內容是什么?自定義控制元件的屬性?如果是這樣,您可以嘗試使用資料觸發器。
或者它是您的視圖模型中的一個屬性,您可以嘗試在視圖模型中宣告一個布爾變數并將 IsVisiable 系結到該變數。然后設定get方法如:
get => return !StudentDetail.StudentType == "Diploma";
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/506332.html
上一篇:Xaml通過兩列制作元素
