Here is the xaml code of my ListBox
:
<ListBox x:Name="BoardList" >
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<TextBox IsReadOnly="True" ScrollViewer.VerticalScrollBarVisibility="Visible" Text="{Binding}" TextWrapping="Wrap" Foreground="DarkBlue"></TextBox>
<AppBarButton Visibility="Collapsed" Icon="Globe" Click="OpenInBrowser" x:Name="Link"></AppBarButton>
<AppBarButton Icon="Copy" Click="Copy"></AppBarButton>
<AppBarButton Icon="Delete" Click="Delete"></AppBarButton>
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
The ItemSource
gets binded to a simple list of strings which is called notes
.
Now I check if the note
begins with http
and if it does the AppBarButton
"link" for this specific item should be Visible
. How do I achieve that? I already wrote the loop.
for (int i = 0; i < notes.Count; i++)
{
if (notes[i].StartsWith("http"))
{
}
}