I have a simple listview with one column in a gridview for displaying a list of names, (Using a listview instead of a listbox because more columns will be added later) The listview are dispayed on multiple windows so I have a separate resourcedictionary file defining the style of the listview. My issue starts when trying to edit the border of the listview the items do not populate the list.
Still new to WPF, thanks for any help.
Listview Xaml:
<ListView Grid.Column="1"
Width="130"
ItemsSource="{Binding Users}">
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style>
<Setter Property="FrameworkElement.Visibility" Value="Collapsed"/>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn Header="Names" Width="130" DisplayMemberBinding="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged}"/>
</GridView>
</ListView.View>
</ListView>
ListviewTheme.xaml:
<Style x:Key="{x:Type ListView}" TargetType="{x:Type ListView}">
<Setter Property="Background" Value="#2F3136"/>
<Setter Property="BorderBrush" Value="#FFABAdB3"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="1,1,1,3" />
<Setter Property="Padding" Value="0,2,0,2"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Visible"/>
<!-- If I add the code below the list will not show -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListView}">
<!-- If I set a background in the border I see an outline of the listview but no items will be added -->
<Border CornerRadius="3"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Still new to WPF, thanks for any help.