Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't fire PointerPressed event from a Listbox in WinRT
    primarykey
    data
    text
    <p>I have a ListBox bound to some data, all with an ItemTemplate set, I want to fire PointerPressed Event from this list by pressing anywhere in the ListBox area (cause I just need that for some purpose), but apparently the Selection of the items is preventing that, (I'm using commands) here's my code </p> <pre><code>&lt;ScrollViewer x:Name="sv" x:FieldModifier="public" VerticalScrollBarVisibility="Visible" VerticalScrollMode="Enabled" HorizontalScrollBarVisibility="Disabled" HorizontalScrollMode="Disabled"&gt; &lt;ListBox x:Name="lb" ItemsSource="{Binding Path=Tweets}"&gt; &lt;WinRTBehaviors:Interaction.Behaviors&gt; &lt;Win8LnBehaviors:EventToCommandBehavior Event="PointerPressed" Command="svPointerPressed" PassEventArgsToCommand="True" /&gt; &lt;/WinRTBehaviors:Interaction.Behaviors&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;Grid Height="65"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="65"&gt;&lt;/ColumnDefinition&gt; &lt;ColumnDefinition Width="2*"&gt;&lt;/ColumnDefinition&gt; &lt;ColumnDefinition Width="3*"&gt;&lt;/ColumnDefinition&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="*"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="2*"&gt;&lt;/RowDefinition&gt; &lt;/Grid.RowDefinitions&gt; &lt;Image x:Name="Img_ProfilePicture" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Stretch="Fill" Source="{Binding ProfilePictureSource}" Margin="2"&gt; &lt;/Image&gt; &lt;TextBlock x:Name="Tb_ProfileName" Grid.Row="0" Grid.Column="1" Text="{Binding UserName}" Margin="5,0,0,0" FontFamily="Segoe UI Mono" FontSize="12" FontWeight="Bold" /&gt; &lt;TextBlock x:Name="Tb_FeedTime" Grid.Row="0" Grid.Column="2" Text="{Binding StatusDateTime}" Margin="5,0,0,0" FontFamily="Segoe UI Light" FontSize="10" /&gt; &lt;TextBlock x:Name="Tb_FeedData" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Text="{Binding Status}" Margin="10,0,0,0" FontFamily="Wasco Sans" TextWrapping="Wrap"&gt; &lt;/TextBlock&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; &lt;/ListBox.ItemTemplate&gt; &lt;/ListBox&gt; &lt;/ScrollViewer&gt; </code></pre> <p>The code behind :</p> <pre><code>public RelayCommand&lt;RoutedEventArgs&gt; svPointerPressed { get { return new RelayCommand&lt;RoutedEventArgs&gt;((routedEventArgs) =&gt; { _dispatcher = Window.Current.Dispatcher; _dispatcher.RunAsync(CoreDispatcherPriority.High, () =&gt; { MessageDialog m = new MessageDialog("Tapped !"); m.ShowAsync(); }); }); } private set{} } </code></pre> <p>I even tried to fire the PointerPressed event from one of the components like those TextBoxes but still not firing.</p> <p>I'd be so thankful , thx </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload