How to deal with management inside the stack panel in windows phone7?

i page design below.

<ScrollViewer VerticalScrollBarVisibility="Visible" Grid.Row="1" x:Name="svProduct"> <StackPanel> <ItemsControl x:Name="lstSearchResult" ItemsSource="{Binding Path=PIProductList}"> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Width="480" Style="{Binding CellStyle}" Orientation="Horizontal" VerticalAlignment="Center" Height="50" > <TextBlock Foreground="Black" FontSize="20" Width="320" FontFamily="Tahoma" Margin="10,0,0,0" Text="{Binding Title}" VerticalAlignment="Center" TextWrapping="Wrap"></TextBlock> <Button Name="btnBookmark" Click="btnBookmark_Click" Tag="{Binding}" Background="Transparent"> <Button.Content> <Image Source="/Images/bookmarks_red.png" Width="33" Height="30" VerticalAlignment="Top" Margin="-15"></Image> </Button.Content> </Button> <Button BorderThickness="0" x:Name="btnSubmit" Click="btnSubmit_Click" Background="Transparent" Tag="{Binding}" > <Button.Content> <Image Name="ram" Source="/Images/blue_arrow.png" Width="40" Height="40" VerticalAlignment="Top" Margin="-15"></Image> </Button.Content> </Button> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </StackPanel> </ScrollViewer> 

I want to access btnBookmark visuble false.

cannot access btnBookmark.Visibility = Visibility.collapsed

how to do it?

please help me...........

+4
source share
1 answer

The best way I know this is to create a Visiblity property for your ViewModel (the one that is attached to each row in the ItemsControl) and toggle this value based on the changes of each element, presumably through a switch in each row. I don’t know about a good way to "loop and look" at these internal controls. You are much better off using your existing data binding infrastructure to manage this for you.

+1
source

All Articles