I am trying to dynamically create a textbox and a button in a listview and that works fine. Next thing iam trying is to get the text present in the dynamically created textbox and display as a content of a button on a button_click event.I am confused and don`t know how to access the dynamicaaly created button or text in the code behind as "name property" is not valid for the same.
Any suggestion are welcomed......
XAML
<ListView Height="222" HorizontalAlignment="Left" Margin="341,24,0,0" Name="listView1" VerticalAlignment="Top" Width="290" Background="Green"
AllowDrop="True"
DragDrop.Drop="listview_drop"
DragDrop.DragEnter="treeview_dragenter" ItemsSource="{Binding XPath=self::*}"></pre>
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" x:Name="stc">
<TextBlock Text="{Binding Path=Name}" Margin="0,0,3,0"/>
<ComboBox Margin="0,0,3,0" x:Name="cbox1">
<ComboBoxItem Content="Less Than"/>
<ComboBoxItem Content="Greater Than"/>
<ComboBoxItem Content="Equals"/>
</ComboBox>
<TextBox Margin="0,0,3,0" Width="50" x:Name="textbox1" />
<Button x:Name="but1" Height="25" Width="35" Click="click" Content="gen" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Code
private void click(object sender, RoutedEventArgs e)
{
//Don`t know what do do here
}