We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Custom IsEnable for each item in CheckListBox

Hi, 
I have a checklistbox which those item have two Property [ Name, IsEnable ]
I want each checklistbox item have Property IsEnable=true so user can only select when IsEnable = true

 <syncfusion:CheckListBox Margin="162,52,162,52" IsSelectAllEnabled="False" ItemsSource="{Binding FolderItems}"

                                 x:Name="checkListBox">

            <syncfusion:CheckListBox.DataContext>

                <viewModel:FileFolderViewModel/>

            </syncfusion:CheckListBox.DataContext>

            <syncfusion:CheckListBox.ItemTemplate>

                <DataTemplate>

                    <StackPanel Orientation="Horizontal">

                        <TextBlock FontWeight="Bold"

                           Foreground="SkyBlue"

                           Text="{Binding Name}"

                                   IsEnabled="False"/>

                    </StackPanel>

                </DataTemplate>

            </syncfusion:CheckListBox.ItemTemplate>

        </syncfusion:CheckListBox>




1 Reply

GT Gokul Thanudhas Syncfusion Team February 22, 2023 04:52 PM UTC

You can achieve your requirement by customizing the CheckListBoxItem Style. We have prepared a simple sample based on your requirement. Please refer to the sample for your reference


Code Snippets


<Style TargetType="syncfusion:CheckListBoxItem">

     <Setter Property="IsEnabled" Value="{Binding IsEnable}"/>

</Style>


Attachment: CheckListBox_3650161a.zip

Loader.
Up arrow icon