Hi,
I am trying to show a set of selectable items and I want to ensure that the display contents of each item varies as the item is resized. Because RadTileView doesn't support selection, I created a ListBox and set the ItemTemplate to a data template that includes a RadFluidContentControl. My demo code is below. I find that when I resize the listbox is and its items, the RadFluidContentControl does not change its display state; the small contents always display. When I use the same data template in a simple ContentControl (see demo code), I find that I do get the behavior I expect. Question is: how do I use RadFluidContentControl in a ListBox?
Thanks,
Kristy
I am trying to show a set of selectable items and I want to ensure that the display contents of each item varies as the item is resized. Because RadTileView doesn't support selection, I created a ListBox and set the ItemTemplate to a data template that includes a RadFluidContentControl. My demo code is below. I find that when I resize the listbox is and its items, the RadFluidContentControl does not change its display state; the small contents always display. When I use the same data template in a simple ContentControl (see demo code), I find that I do get the behavior I expect. Question is: how do I use RadFluidContentControl in a ListBox?
Thanks,
Kristy
<Window x:Class="RadControlsWpfApp.Window1" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" xmlns:radDock="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking" xmlns:System="clr-namespace:System;assembly=mscorlib" Title="Window1" Height="300" Width="300"> |
<Window.Resources> |
<x:Array x:Key="ComposerList" Type="{x:Type System:String}"> |
<System:String>Mozart, Wolfgang Amadeus</System:String> |
<System:String>Górecki, Henryk Mikolaj</System:String> |
<System:String>Massenet, Jules</System:String> |
</x:Array> |
<System:String x:Key="Composer">Mozart, Wolfgang Amadeus</System:String> |
<DataTemplate x:Key="listboxItemTemplate"> |
<telerik:RadFluidContentControl |
Margin="2" |
SmallToNormalThreshold="190, 40" |
NormalToSmallThreshold="190, 40" |
NormalToLargeThreshold="300, 160" |
LargeToNormalThreshold="300, 160"> |
<!--Small--> |
<telerik:RadFluidContentControl.SmallContent> |
<Border |
BorderBrush="LightBlue" |
BorderThickness="1"> |
<StackPanel Orientation="Horizontal"> |
<TextBlock Text="Small" Margin="3" FontSize="12" /> |
<TextBlock Text="{Binding}" Margin="3" FontSize="12" /> |
</StackPanel> |
</Border> |
</telerik:RadFluidContentControl.SmallContent> |
<!--Normal--> |
<telerik:RadFluidContentControl.Content> |
<Border |
BorderBrush="Blue" |
BorderThickness="1"> |
<StackPanel Orientation="Horizontal"> |
<TextBlock Text="Medium" Margin="3" FontSize="18" /> |
<TextBlock Text="{Binding}" Margin="3" FontSize="18" /> |
</StackPanel> |
</Border> |
</telerik:RadFluidContentControl.Content> |
<!--Large--> |
<telerik:RadFluidContentControl.LargeContent> |
<Border BorderBrush="DarkBlue" BorderThickness="1"> |
<StackPanel Orientation="Horizontal"> |
<TextBlock Text="Large" Margin="3" FontSize="24" /> |
<TextBlock Text="{Binding}" Margin="3" FontSize="24" /> |
</StackPanel> |
</Border> |
</telerik:RadFluidContentControl.LargeContent> |
</telerik:RadFluidContentControl> |
</DataTemplate> |
</Window.Resources> |
<Grid> |
<Grid.RowDefinitions> |
<RowDefinition Height="*"/> |
<RowDefinition Height="*"/> |
</Grid.RowDefinitions> |
<ListBox |
Grid.Row="0" |
HorizontalContentAlignment="Stretch" |
VerticalContentAlignment="Stretch" |
ItemsSource="{StaticResource ComposerList}" |
ItemTemplate="{StaticResource listboxItemTemplate}"/> |
<ContentControl |
Grid.Row="1" |
Content="{StaticResource Composer}" |
ContentTemplate="{StaticResource listboxItemTemplate}"/> |
</Grid> |
</Window> |