Hello,
Welcome to our Microsoft Q&A platform!
based on if value exists in one of the columns in observable collection BookedJobsList
Try to set data binding for the IsEnabled of the xct:Expander control based on the column's value. You could create a custom valueConverter class to detect if the property's value is null and return a bool result.
Here is the sample code, you could refer to it.
<ContentPage.Resources>
<local:ExpanderValueConverter x:Key="converter"/>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout >
<CollectionView ItemsSource="{Binding DataColellection}" >
<CollectionView.ItemTemplate>
<DataTemplate>
<xct:Expander IsEnabled="{Binding TestValue,Converter={StaticResource converter}}">
<xct:Expander.Header>
<StackLayout>
<Label Text="{Binding TheContent}"/>
</StackLayout>
</xct:Expander.Header>
<Button Text="Button"/>
</xct:Expander>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
</ContentPage.Content>
Model calss and custom ValueConverter class
public class TestPageModel
{
...
public string TestValue { get; set; }
}
public class ExpanderValueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var theValue = (string)value;
return theValue != null ? true : false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.