プロジェクトでリストを作成していますが、各項目にボタンが必要です。
Windows phone の「最終通話」ページのように、ListBox でこれらのボタンを取得するにはどうすればよいですか?
ありがとう。
プロジェクトでリストを作成していますが、各項目にボタンが必要です。
Windows phone の「最終通話」ページのように、ListBox でこれらのボタンを取得するにはどうすればよいですか?
ありがとう。
FunksMaNameの答えは、小さな変更を除いて非常に正しいです.....
<ListBox Height="360"
HorizontalAlignment="Left"
Margin="22,23,0,0"
Name="UserDetailsListBox"
VerticalAlignment="Top"
Width="413"> <ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Button.Template>
<ControlTemplate>
<Image Source="/Assets/Images/MyImage.png" />
</ControlTemplate>
</Button.Template>
<TextBlock x:Name="txtOverViewHeader1"
Text="OverView"
Foreground="Yellow"
Width="600"
FontSize="28"
Margin="10,0,0,0"
Height="65">
</TextBlock>
</StackPanel>
</DataTemplate></ListBox.ItemTemplate></ListBox>
コンテンツではなくボタンのテンプレート内に画像を移動しただけです...それはより正確です..
このように、リストボックスの各項目にボタンを追加できます。
<ListBox Height="360"
HorizontalAlignment="Left"
Margin="22,23,0,0"
Name="UserDetailsListBox"
VerticalAlignment="Top"
Width="413">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical"
>
<StackPanel Orientation="Horizontal">
<Button Width="150" Height="50" x:Name="Btn1" Content="Button1" Margin="0,-20,0,0"/>
<TextBlock x:Name="txtOverViewHeader1"
Text="OverView"
Foreground="Yellow"
Width="600"
FontSize="28"
Margin="10,0,0,0"
Height="65">
</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Width="150" Height="50" x:Name="Btn2" Content="Button2" Margin="0,-20,0,0"/>
<TextBlock x:Name="txtOverViewHeader2"
Text="OverView"
Foreground="Yellow"
Width="600"
FontSize="28"
Margin="10,0,0,0"
Height="65">
</TextBlock>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
それがあなたに望ましい答えを与えることを願っています