954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

translating XAML to C# code

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>
ibdatx
Light Poster
32 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: