ibdatx 0 Light Poster

Hi,

Can anyone get the translation of this xaml code to c# code? In order words, I am trying to set listbox items to be displayed in the textblock encapsulated by stackpanel, datatemplate and within listbox.itemtemplate. I am trying to do this from the back end and not using databinding.

Any help is appreciated.

XAML

<ListBox Name="listBox2" Width="224" Height="268" Margin="0,0,0,5" 
   IsSynchronizedWithCurrentItem="False" HorizontalAlignment="Stretch" 
   VerticalAlignment="Stretch" Style="{StaticResource ListBoxStyle1}">
   <ListBox.ItemTemplate>
      <DataTemplate>
         <StackPanel Height="35" Background="#181818">
             <TextBlock Background="Black" Margin="1" FontWeight="Bold" 
                Padding="7" Height="33" Width="184" Foreground="#D0D0D0">
             </TextBlock>
         </StackPanel>
      </DataTemplate>
   </ListBox.ItemTemplate>                   
</ListBox>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.