I am new to C # and trying to develop a Windows 10 UWP application as a project hobby.
Part of MainBrowser.XAML
<GridView x:Name="browserPane" ItemsSource="{x:Bind fileInCurrentFolderList,Mode=OneWay}" SelectionChanged="browserPane_SelectionChanged" Margin="0,48,0,0"> <GridView.ItemTemplate> <DataTemplate x:DataType="classes:Item"> <StackPanel Margin="10"> <Image Height="268" Width="200" Source="{x:Bind Thumbnail}" x:Phase="1" Stretch="UniformToFill"></Image> <TextBlock Width="200" Text="{x:Bind Caption}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" MaxLines="2"/> </StackPanel> </DataTemplate> </GridView.ItemTemplate> </GridView>
This kind of grid is tied to
public sealed partial class MainBrowser : Page { ... private ObservableCollection<Item> fileInCurrentFolderListUI = new ObservableCollection<Item>(); ... }
On the left side of the application there is a list of buttons. Each button will call a method that returns an ObservableCollection<Item> .
The problem is that I need to do something like
foreach (Item file in ReturnObservableCollection) { fileInCurrentFolderList.Add(item); }
Instead of this
fileInCurrentFolderList = ReturnObservableCollection;
Ability to run updates in the user interface. How can i change this?
source share