MAUI CollectionView Parent value to children example/guidance needed

This should (hopefully) be an easy thing to answer. I have a collection view that is bound to a JSON data source, and a button in the first level of the JSON file that I store a value for (in Preferences) and change the button based on if it’s stored or not (color, text changes). It then creates a child collection view, which each of the items also have a button for a similar function, except that if the first button is clicked, I want to be able to hide the buttons that are for the children.

Think of it as this: you have a list of box of different types of unique widgets. The parent button allows you to click to save that you own all of the widgets without having to click on each one, but if you haven’t clicked the full box, and you only own Widget A, I want to allow you to select Widget A and have it track that you own only Widget A. So, to accomplish scenario one, I want to have a user click the parent button, which would then make all of the buttons in the child area for that parent not visible so that it won’t get confusing having the child buttons there if the parent is marked as owned.

I have the collection views set up, the buttons created, and function that saves whether one or the other is owned, and it all works great. I just can’t find any examples that aren’t extremely complicated with code that obfucsates what to do on a conceptual level. I thought about doing an observable object, but not sure how to accomplish that when there are multiple parent objects. I also found something about ancestor binding, but I couldn’t find an example that explained it all very well. One of my coworkers suggested looping through the child controls, but I haven’t found a good example of that, and not sure how well that would work.

Here is a (very) trimmed down example of the XAML file:

<CollectionView x.Name="ParentCollection" ItemsSource="{Binding Parent}">
    <CollectionView.ItemTemplate>
        <DataTemplate>
           <Frame>
              <Button Text="{Binding ParentOwned}" Clicked="OwnedButtonClick" WidthRequest="100"></Button>
              <ScrollView>
                    <CollectionView x.Name="ChildCollection" ItemsSource="{Binding Child}>
                        <CollectionView.ItemTemplate>
                            <DataTemplate>
                                <Frame>
                                    <Button Text="{Binding ChildOwned}" Clicked="OwnedButtonClick" WidthRequest="100"></Button>
                                </Frame>
                            </DataTemplate>
                        </CollectionView.ItemTemplate>
                     </CollectionView>
                 </ScrollView>
            </Frame>
        </DataTemplate>
    </CollectionView.ItemTemplate>
</CollectionView>

Of course, it’s FAR more complicated than this, but I want to keep the question and solution as simple as possible for clarity sake (and for those who may come in behind me with the same question).

Haven’t really tried much at the moment, as I haven’t found a good direction to go with it yet.

New contributor

Joe Schmidt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật