Windows Phone 全景应用程序中的收藏夹

发布于 2024-11-14 04:23:22 字数 1612 浏览 4 评论 0原文

我有一个全景应用程序,其中全景项目之一是“收藏夹”。我使用带有 ItemViewModel 和 MainViewModel 的标准 Windows Phone 项目来开始。我用一个简单的字符串“Favorite”替换了 lineone/two/third 。实际上,我从 LoadData() 函数中的独立存储加载收藏夹数据,并使用以下方式填充“项目”:

        IsolatedStorageFileStream favoritesFile = store.OpenFile("favorites.txt", FileMode.OpenOrCreate, FileAccess.Read); 
        string lines; 

        Items.Clear(); 
        using (StreamReader reader = new StreamReader(favoritesFile)) 
        { 
            while ((lines = reader.ReadLine()) != null) 
            { 
                this.Items.Add(new ItemViewModel() { Favorite = lines }); 
            } 
        } 

我希望不仅能够在此全景项目中查看我的收藏夹,还可以删除它们(添加一个项目)因为当我导航到项目详细信息页面时,收藏夹被覆盖)。我考虑过的两个选项是:

  • 在文本旁边显示黄色星号。单击星号将从列表中删除该项目。
  • 某种形式的按住 -->删除动作。

对于第一个,我不确定删除项目后如何刷新列表。显然,我无法导航到同一页面:) 另外,我如何知道哪个星星对应于哪个最喜欢的项目,因为最喜欢的项目将绑定在 xaml 中,如下所示:

                            <TextBlock Margin="10,10,0,0" Text="{Binding Favorite}" TextWrapping="Wrap" Style="{StaticResource PhoneTextSubtleStyle}" Grid.Column="0" />
                            <Button Grid.Column="1" Click="FavoriteButton_Click" BorderThickness="0" Height="40">
                                <Button.Background>
                                    <ImageBrush ImageSource="/WindowsPhonePanoramaApplication2;component/Images/appbar.feature.email.rest.png" Stretch="None" />
                                </Button.Background>
                            </Button>

对于第二个,可发现性是一个问题,加上我甚至不知道第三方应用程序是否支持此功能。我倾向于第一个选项,因为它相当直观。请指教。

I have a Panorama Application, where one of the panorama items is 'Favorites'. I used a standard Windows Phone project with ItemViewModel and MainViewModel to get started. I replaced the lineone/two/three with a simple string 'Favorite'. I actually load the favorites data from isolated storage in the LoadData() function, and populate 'Items' using:

        IsolatedStorageFileStream favoritesFile = store.OpenFile("favorites.txt", FileMode.OpenOrCreate, FileAccess.Read); 
        string lines; 

        Items.Clear(); 
        using (StreamReader reader = new StreamReader(favoritesFile)) 
        { 
            while ((lines = reader.ReadLine()) != null) 
            { 
                this.Items.Add(new ItemViewModel() { Favorite = lines }); 
            } 
        } 

I'd like to be able to not just view my favorites in this panorama item, but delete them as well (adding an item as favorite is covered when I navigate to the item detail page). Two options I've considered are:

  • Displaying a yellow star next to the text. Clicking on the star would remove the item from the list.
  • Some sort of press and hold --> delete action.

For the first one, I'm not sure how to refresh the list once the item is deleted. Apparently, I cannot navigate to the same page :) Also, how can I tell which star corresponds to which favorite item, since the favorite item will be bound in xaml, like so:

                            <TextBlock Margin="10,10,0,0" Text="{Binding Favorite}" TextWrapping="Wrap" Style="{StaticResource PhoneTextSubtleStyle}" Grid.Column="0" />
                            <Button Grid.Column="1" Click="FavoriteButton_Click" BorderThickness="0" Height="40">
                                <Button.Background>
                                    <ImageBrush ImageSource="/WindowsPhonePanoramaApplication2;component/Images/appbar.feature.email.rest.png" Stretch="None" />
                                </Button.Background>
                            </Button>

For the second one, discoverability is an issue, plus I don't even know if this is supported for third party apps. I'm leaning towards the first option as it's fairly intuitive. Please advise.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一口甜 2024-11-21 04:23:22

如果您的待办事项列表是一个 ObservableCollection,在更改时会发出 NotifyPropertyChanged 事件,那么您无需担心自己重新加载列表,数据绑定会自行处理此问题。

对于可发现性,我认为按住是很常见的。 Silverlight Toolkit for WP7 (http://silverlight.codeplex.com) 中免费提供按住组件(上下文菜单)

If your todo list is an ObservableCollection that sends out NotifyPropertyChanged event when it is changed, then you don't need to worry about reloading the list your self, databinding takes care of this itself.

For the discoverability, press and hold is quite common i think. The press and hold component (context menu) is available for free in Silverlight Toolkit for WP7 (http://silverlight.codeplex.com)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文