Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

ItemTemplate for UserControl problem

$
0
0
Hi,

I have as list of usercontrols (Days) wich is bound to an ItemsControl.
I want every UserControl to have a border but when i try to do that with an ItemTemplate nothing happens. It's like the ItemTemplate is not used.
I don't want to add the border to the Day usercontrol.
What am i doing wrong?

This is xaml i am using:

  <ItemsControl ItemsSource="{Binding Days}">

    <ItemsControl.ItemsPanel>
      <ItemsPanelTemplate>
        <WrapPanel Orientation="Vertical"/>
      </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>

    <ItemsControl.ItemTemplate>
      <DataTemplate>
        <Border BorderThickness="5" BorderBrush="Black">
          <ContentPresenter/>
       </Border>
      </DataTemplate>
    </ItemsControl.ItemTemplate>
    
  </ItemsControl>

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>