如何删除“;聚焦;来自XAML列表框的边框?

如何删除“;聚焦;来自XAML列表框的边框?,xaml,listbox,microsoft-metro,Xaml,Listbox,Microsoft Metro,这个问题与列表框本身有关,而不是它的单元格。如果我将listbox放入一个viewbox中,并单击一个项目,整个listbox将被1px边框包围。我不想要那个,因为它很难看。如何删除此边界 详情: <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Viewbox Grid.Row="1" Stretch="Uniform"> <StackPanel

这个问题与列表框本身有关,而不是它的单元格。如果我将listbox放入一个viewbox中,并单击一个项目,整个listbox将被1px边框包围。我不想要那个,因为它很难看。如何删除此边界

详情:

  <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Viewbox Grid.Row="1" Stretch="Uniform">
      <StackPanel Orientation="Horizontal" Margin="0,20,0,20">
        <Grid Width="200">
          <ListBox ItemsSource="{Binding Rajzelemek}" Background="{x:Null}">
            <ListBox.ItemTemplate>
              <DataTemplate>
                <StackPanel Orientation="Horizontal">
                  <ContentControl Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Content="{Binding Ikonja}" Width="25" Height="25" VerticalAlignment="Center" />
                  <TextBlock Text="{Binding}" VerticalAlignment="Center" Foreground="{ThemeResource ApplicationForegroundThemeBrush}" />
                </StackPanel>
              </DataTemplate>
            </ListBox.ItemTemplate>
            <ListBox.ItemsPanel>
              <ItemsPanelTemplate>
                <StackPanel Orientation="Vertical" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" />
              </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
          </ListBox>
        </Grid>
      </StackPanel>
    </Viewbox>
  </Grid>


如果我对
进行注释,我认为您正在查找
ListBoxItem
模板中的内容,其中有一个
矩形
充当焦点视觉,如果您签出,您将看到它的默认笔刷(FocusVisualWhiteStrokeThemeBrush),您可以在模板中更改,或者提供您自己的资源,让它在点击默认字典之前查找,如

   <SolidColorBrush x:Key="FocusVisualWhiteStrokeThemeBrush" Color="Transparent" />

不是listbox项,而是listbox本身有一个边框(围绕所有项,并且项没有边框)。我无法用此信息解决我的问题;我可以问你更多的细节吗?@Zéiksz请看编辑后的答案,对不起,我只是看了你的截图,没有阅读关于
视图框的部分。答案完全符合逻辑,“应该有效”,但没有。我不知道它是否能在WPF下正常工作,但对于metro,listbox内部仍然有一个边界-只有listbox或它的listitem之一被聚焦时才有边界。我甚至在listbox资源下尝试了这个“targettype边框”的东西-到目前为止运气不好。是的,但我需要它来扩展UI。我刚刚检查了GridView,它没有边框。我猜,如果那东西真的是一个边界,那么它也会扩展。
<Viewbox>
              <Viewbox.Resources>
                <Style TargetType="Border">
                  <Setter Property="BorderBrush" Value="Transparent" />
                  <Setter Property="BorderThickness" Value="0" />
                </Style>
              </Viewbox.Resources>

...

</ViewBox>