I am trying to make a custom display board to help manage our client rooms.
Table 1 named Rooms [RoomID, RoomNumber, RoomDescription, ADA, RoomStatus]
Table 2 named Beds [BedID, BedNumber, RoomID, BedEnabled]
Table 3 named Clients [ClientID, BedID, RoomID and other fields for client information]
There can be more then 1 bed associated to a room. For example Room 101 has 2 beds, we then can assign 2 clients to room 101.
I been trying to use Grid and StackPanel to list all rooms. Then in each Room List all Beds, then for each bed if a client is assigned I was going to use TextBlock to show client information. I am gathering this is not something I can do straight in the xaml but probably need to do some code behind with loops?
<Window x:Class="BoardDisplay.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BoardDisplay"
mc:Ignorable="d"
Title="Window1" Height="450" Width="800" Loaded="Window_Loaded">
<Window.Resources>
<local:Room_ManagerDataSet x:Key="room_ManagerDataSet"/>
<CollectionViewSource x:Key="roomsViewSource" Source="{Binding Rooms, Source={StaticResource room_ManagerDataSet}}"/>
<CollectionViewSource x:Key="bedsViewSource" Source="{Binding Beds, Source={StaticResource room_ManagerDataSet}}"/>
</Window.Resources>
<Grid Margin="10">
<ItemsControl ItemsSource="{Binding Source={StaticResource roomsViewSource}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding RoomNumber}" Margin="0,0,5,5">
<Grid>
<ItemsControl ItemsSource="{Binding Source={StaticResource bedsViewSource}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding BedNumber}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</TextBlock>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Window>