次のように、Windows Phone 8 用の UserControl を開発しました。
<UserControl x:Class="SpinrWindowsMobile.UserControls.ProgressiveLongListSelector"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
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"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
d:DesignHeight="480" d:DesignWidth="480">
<Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<phone:LongListSelector Grid.Row="0" Name="longlistselector">
</phone:LongListSelector>
<StackPanel Grid.Row="1">
<ProgressBar Name="listProress" IsIndeterminate="True"></ProgressBar>
<TextBlock Name="ProgressText" Text="Loading..."></TextBlock>
</StackPanel>
</Grid>
</UserControl>
上記の xaml でわかるように、 Grid Control 内でLongListSelector と StackPanelを使用していました。次のように MainPage.xaml でこのコントロールを使用しています。
<phone:PhoneApplicationPage
x:Class="SpinrWindowsMobile.MainPage"
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:UserControls="clr-namespace:SpinrWindowsMobile.UserControls"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<UserControls:ProgressiveLongListSelector>
</UserControls:ProgressiveLongListSelector>
</Grid>
</phone:PhoneApplicationPage>
ここまででいいのですが、次のようなことをしたいです。
<UserControls:ProgressiveLongListSelector>
<UserControls:ProgressiveLongListSelector.longlistselector
ItemsSource="Binding" ItemTemplate="{staticresource myTemplate}">
</UserControls:ProgressiveLongListSelector.longlistselector>
</UserControls:ProgressiveLongListSelector>
UserControlの要素/コンポーネントである longlistselectorにアクセスするにはどうすればよいですか? これの利点はです。私にとって、この種のものは今日の要件です。I can directly set the LongListSelector Properties in the xaml(in which i am embedding My usercontrol) itself
誰でもこれを行う方法を教えてもらえますか?