0
내 Windows Phone 애플리케이션에서 한 페이지에 LoadMore 버튼이 있습니다. loadmore 버튼은 style
의 <phone:PhoneApplicationPage.Resources>
섹션에 정의되어 있습니다. 그 페이지에 2 개의 목록 상자가 있고 두 개의 목록 상자에 동일한 스타일을 사용합니다. loadmore 버튼을 클릭하면 listbox에서 이벤트를 발생시키는 LoadMore 버튼을 어떻게 식별 할 수 있습니까?클릭 한 버튼 찾기
<phone:PhoneApplicationPage.Resources>
<Style x:Key="ListBoxStyle" TargetType="ListBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Visible"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<ScrollViewer x:Name="ScrollViewer">
<StackPanel>
<ItemsPresenter/>
<Button Content="Load More..." Name="btnLoadMore" Visibility="Visible" Background="White" Foreground="#FF176DDC" Click="btnLoadMore_Click"></Button>
</StackPanel>
</ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</phone:PhoneApplicationPage.Resources>
어떻게하면 목록 상자가 클릭 된 버튼을 찾을 수 있습니까?
btnLoadMore_Click 이벤트 핸들러에서'sender' 매개 변수를 체크 아웃해야합니다. 다시 버튼으로 보내고 이름을 확인하십시오. 이름에 이중 접미어가 붙지 않기 때문에 접미어가 추가 될 것입니다. –
@Gerald Versus : 나는 그것을 사용했지만 아무런 노력을 기울이지 않았다. 때마다 나는 같은 이름을 얻었다. 즉 btnLoadMore. 그런 다음 버튼 이름을 제거하고 시도했지만 이름이 없습니다. –