Hello together,
I use a RadPanelBar to display a List of Dates in a range grouped by week (to better understand I added a picture). If I click a day I want to load right beside it a Datatable into a RadGridView based on the date I selected.
I managed to bind the RadPanelBar to my ViewModel:
<
telerik:RadPanelBar
Grid.Column
=
"0"
x:Name
=
"rpbKWs"
ExpandMode
=
"Multiple"
ItemsSource
=
"{Binding WochenAnzeige}"
SelectedItem
=
"{Binding selTag, Mode=TwoWay}"
>
<
telerik:RadPanelBar.ItemTemplate
>
<
HierarchicalDataTemplate
ItemsSource
=
"{Binding TageAnzeige}"
>
<
HierarchicalDataTemplate.ItemTemplate
>
<
DataTemplate
>
<
StackPanel
>
<
TextBlock
FontWeight
=
"Medium"
Text
=
"{Binding Path=Datum, StringFormat={}{0:dd.MM.yyyy}}"
/>
<
TextBlock
Margin
=
"0 5 0 0"
FontSize
=
"{StaticResource Caption}"
Text
=
"{Binding Path=Einträge, StringFormat={}Einträge: {0}}"
/>
<
TextBlock
Margin
=
"0 2 0 0"
FontSize
=
"{StaticResource Caption}"
Text
=
"{Binding Path=EinträgeImWerk, StringFormat={}davon im Werk: {0}}"
/>
<
TextBlock
Margin
=
"0 2 0 0"
FontSize
=
"{StaticResource Caption}"
Text
=
"{Binding Path=EinträgeMontageEingeteilt, StringFormat={}davon in Montage: {0}}"
/>
</
StackPanel
>
</
DataTemplate
>
</
HierarchicalDataTemplate.ItemTemplate
>
<
StackPanel
>
<
TextBlock
FontWeight
=
"Medium"
>
<
TextBlock.Text
>
<
MultiBinding
StringFormat
=
"{}KW {0} Jahr {1}"
>
<
Binding
Path
=
"KW"
/>
<
Binding
Path
=
"Jahr"
/>
</
MultiBinding
>
</
TextBlock.Text
>
</
TextBlock
>
<
TextBlock
FontSize
=
"{StaticResource Caption}"
>
<
TextBlock.Text
>
<
MultiBinding
StringFormat
=
"{}{0:dd.MM.yy} - {1:dd.MM.yy}"
>
<
Binding
Path
=
"MinDatum"
/>
<
Binding
Path
=
"MaxDatum"
/>
</
MultiBinding
>
</
TextBlock.Text
>
</
TextBlock
>
<
TextBlock
Margin
=
"0 5 0 0"
FontSize
=
"{StaticResource Caption}"
Text
=
"{Binding Path=Einträge, StringFormat={}Einträge: {0}}"
/>
<
TextBlock
Margin
=
"0 2 0 0"
FontSize
=
"{StaticResource Caption}"
Text
=
"{Binding Path=EinträgeImWerk, StringFormat={}davon im Werk: {0}}"
/>
<
TextBlock
Margin
=
"0 2 0 0"
FontSize
=
"{StaticResource Caption}"
Text
=
"{Binding Path=EinträgeMontageEingeteilt, StringFormat={}davon in Montage: {0}}"
/>
</
StackPanel
>
</
HierarchicalDataTemplate
>
</
telerik:RadPanelBar.ItemTemplate
>
</
telerik:RadPanelBar
>
But have problems with the SelectedItem. The days and weeks are different classes, because they contain different properties for example the week contains a List of days.
If I bind the SelectedItem to the 'selTag' and set a selTag in code nothing happens.
If I change the Selection in UI the property is updated, so this part works.
But if I select a week in UI my whole RadPanelBar gets a red border I don't understand where it comes from. Maybe because a week is a different class then a day and cant be updated because of that?
Is there a way to bind the SelectedItem poperty of a hierarchical RadPanelBar for the parent and chield levels seperately? Or some compleetely different solution?
I have uploaded my project here: https://www.dropbox.com/s/dxbaignaf8rxcx7/ReklamationsManagement.zip?dl=0
It will definitely not run because a sql connection and has some things in it I not longer use, but maybe you better understand my classes there.
Greetings
Benedikt