C#のWindows Phone 7アプリにTelerik RadDataBoundListboxがあります。リスト アイテムのアイテム テンプレートを追加したいと考えています。これを行うには、Visual Studio 2012 で次のことを行います。
- ドキュメント アウトラインのリスト ボックスを右クリックします。
- 追加テンプレートの編集を選択します
- テンプレートの編集を選択
- 空の作成を選択します
これを行うと、ポップアップ ダイアログ ボックスに「テンプレートの作成に失敗しました」というエラー メッセージが表示されます。
私が気づいたことの 1 つは、標準のリスト ボックス (Telerik 以外) の場合と同様に、 [追加テンプレートの編集] コンテキスト メニューに [生成されたアイテムの編集 (ItemTemplate) ] のオプションがないことです。Telerik データ バインド リスト ボックスのアイテム テンプレートを作成/編集するには、何をする必要がありますか?
この Telerik ヘルプ ページでは、アイテム テンプレートを作成する手順を説明していますが、XAML を直接編集し、ItemTemplate ではなく DataTemplate 要素を使用しますが、これは RadDataboundListBox ではなく RadListBox 用です。IDE、特にExpression Blendから直接行う方法があるかどうか疑問に思っています:
Telerik RadListBox カスタム アイテム テンプレート
以下は、リスト ボックスの現在の XAML です。
<phone:PhoneApplicationPage
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Helpers="clr-namespace:FindAPet_WP7.Helpers" xmlns:ViewModel="clr-namespace:FindAPet_WP7.ViewModel" xmlns:telerikPrimitives="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"
x:Class="FindAPet_WP7.Page4"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.Resources>
<Helpers:EnumToDescAttrConverter x:Key="EnumToDescAttrConverter"/>
<!-- <telerik:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/> -->
<Helpers:BusyVisibilityConverter x:Key="BusyVisibilityConverter" />
</phone:PhoneApplicationPage.Resources>
<phone:PhoneApplicationPage.FontFamily>
<StaticResource ResourceKey="PhoneFontFamilyNormal"/>
</phone:PhoneApplicationPage.FontFamily>
<phone:PhoneApplicationPage.FontSize>
<StaticResource ResourceKey="PhoneFontSizeNormal"/>
</phone:PhoneApplicationPage.FontSize>
<phone:PhoneApplicationPage.Foreground>
<StaticResource ResourceKey="PhoneForegroundBrush"/>
</phone:PhoneApplicationPage.Foreground>
<phone:PhoneApplicationPage.DataContext>
<ViewModel:ViewModelLocator/>
</phone:PhoneApplicationPage.DataContext>
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding Main.AppName, Mode=OneWay}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="Choose Shelters" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" FontSize="48" Height="55"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="0*"/>
<RowDefinition Height="8*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<telerikPrimitives:RadBusyIndicator
Content="Telerik Loading..."
Foreground="#FF9EC6EE"
IsRunning="True"
Opacity="0.75"
Margin="3,48,-14,5"
Visibility="{Binding Main.IsBusyLoading, Converter={StaticResource BusyVisibilityConverter}, FallbackValue=Collapsed, Mode=OneWay}" FontSize="48" Grid.RowSpan="2" d:IsHidden="True" />
<Button x:Name="btnTest" Content="Test" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,0,0,0" Height="72" Grid.Row="2" Width="129" Command="{Binding Main.DisplayMessageCommand, Mode=OneWay}"/>
<telerikPrimitives:RadDataBoundListBox x:Name="listShelters" ItemsSource="{Binding Main.ShelterList}" SelectedItem="{Binding Main.SelectedShelter.IsChecked, Mode=TwoWay}" SelectionChanged="listShelters_SelectionChanged" Visibility="{Binding Main.IsBusyLoading, ConverterParameter=true, Converter={StaticResource BusyVisibilityConverter}, Mode=OneWay}" EmptyContent="" IsCheckModeActive="True" IsCheckModeEnabled="True" ItemCheckedStateChanged="listShelters_ItemCheckedStateChanged" CheckModeDeactivatedOnBackButton="False" DisplayMemberPath="Name" LayoutUpdated="listShelters_LayoutUpdated" Loaded="listShelters_Loaded" ItemCheckedPath="IsChecked" Grid.Row="1"/>
</Grid>
</Grid>
</phone:PhoneApplicationPage>