Question: I need to use a WebView to load certain webpages and dynamically change the css before showing them to the user (which means I have to delete all `<link>` tags and append the one with my css). (Why? Because I want to adapt the look of a particular site - which is not mine - for smartphones)

Now, I've seen that similar questions have been answered that the only way to modify the html before showing it to the user is by executing some javascript in the onPageFinished method; this could be a solution, but I'd like to consider other possibilities as well.

So, my questions are: 

1) If I go deeper in the source of the WebView class, is it possible to find where the html is loaded from the site, so that I have direct access to the html and I can modify it as I want?

2) If yes, is WebView the class that handles the communication and retrieves the html? If else, which one is it?

3) Assuming that what I asked is possible, do you think that the application would perform better if the modification to the html where made this way instead of using javascript?

Answer: 
This is a bit of a hack, but it works well and allows you to use commands and avoid code behind. This also has the added benefit of not triggering the command when you double-click (or whatever your trigger is) in the empty `ScrollView` area assuming your `ListBoxItems` don't fill the entire container.

Basically, just create a `DataTemplate` for your `ListBox` that is composed of a `TextBlock` and bind the width of the `TextBlock` to the width of the `ListBox`, set the margins and padding to 0, and disable horizontal scrolling (because the `TextBlock` will bleed beyond the visible bounds of the `ScrollView` triggering the horizontal scroll bar otherwise). The only bug I've found is that the command won't fire if the user clicks precisely on the border of the `ListBoxItem`, which I can live with.

Here is an example:

```
<ListBox
    x:Name="listBox"
    Width="400"
    Height="150"
    ScrollViewer.HorizontalScrollBarVisibility="Hidden"
    ItemsSource="{Binding ItemsSourceProperty}"
    SelectedItem="{Binding SelectedItemProperty}">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <TextBlock Padding="0" 
                        Margin="0" 
                        Text="{Binding DisplayTextProperty}" 
                        Width="{Binding ElementName=listBox, Path=Width}">
                <TextBlock.InputBindings>
                    <MouseBinding 
                        Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBox}}, Path=DataContext.SelectProjectCommand}" 
                                    Gesture="LeftDoubleClick" />
                </TextBlock.InputBindings>
            </TextBlock>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>

```
If you're looking for a nice simple solution that uses interactions instead of mucking about with user controls, code behind, input bindings, custom attached properties, etc.

And you want something that works at the ListBoxItem level, i.e. not ListBox level as per the (incorrectly) accepted solution.

Then here's a snippet for a simple 'button like' click action..

```
<ListBox>
  <ListBox.ItemTemplate>
    <DataTemplate>
      <Grid Background="Transparent">
        <!-- insert your visuals here -->

        <b:Interaction.Triggers>
          <b:EventTrigger EventName="MouseUp">
            <b:InvokeCommandAction Command="{Binding YourCommand}" />
          </b:EventTrigger>
        </b:Interaction.Triggers>
      </Grid>
    </DataTemplate>
  </ListBox.ItemTemplate>
</ListBox>

```

Note, background="Transparent" is required to ensure the entire Grid is clickable and not just the contents inside.