XAML:
<ListView x:Name="lvProjects" x:Uid="lvProjects" Margin="0,10,20,0" Foreground="Blue"
>
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="31"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBox x:Name="tbxProjectName" Text="{Binding showedName, UpdateSourceTrigger=Explicit, Mode=TwoWay}"
Grid.Column="0" HorizontalAlignment ="Stretch" BorderThickness="0" >
</TextBox>
<Button x:Name="btnProjectItemButton" Content=".." Grid.Column="1" HorizontalAlignment="Right" Margin="5,0,0,0"
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
sorry I pasted not full question text. Full question below:
Hello,
I have a ListView defined as:
Now I want to Remove from ItemTemplate Button. I want to do this code behind.
Tried to do this with code: ElementFactoryGetArgs efga = new ElementFactoryGetArgs(); Grid g = (Grid)lvProjects.ItemTemplate.GetElement(efga); g.Children.RemoveAt(1);
But I failed. Please answer how to remove button from the ItemTemplate code behind.
Something removes my XAML Code from the post
It's a known issue that currently Microsoft Q&A can't post Xaml code. Please refer to this post: Can not insert XML/XAML Code in Post for a workaround.
Then share the Xaml code with me so that I could take a look at your issue.
Sign in to comment