<bdo id='7AE3V'></bdo><ul id='7AE3V'></ul>
    1. <small id='7AE3V'></small><noframes id='7AE3V'>

      <i id='7AE3V'><tr id='7AE3V'><dt id='7AE3V'><q id='7AE3V'><span id='7AE3V'><b id='7AE3V'><form id='7AE3V'><ins id='7AE3V'></ins><ul id='7AE3V'></ul><sub id='7AE3V'></sub></form><legend id='7AE3V'></legend><bdo id='7AE3V'><pre id='7AE3V'><center id='7AE3V'></center></pre></bdo></b><th id='7AE3V'></th></span></q></dt></tr></i><div id='7AE3V'><tfoot id='7AE3V'></tfoot><dl id='7AE3V'><fieldset id='7AE3V'></fieldset></dl></div>

      <legend id='7AE3V'><style id='7AE3V'><dir id='7AE3V'><q id='7AE3V'></q></dir></style></legend>
    2. <tfoot id='7AE3V'></tfoot>

      1. WPF中类似访问的数据导航?

        时间:2023-08-28
        • <bdo id='oERyz'></bdo><ul id='oERyz'></ul>

                  <tbody id='oERyz'></tbody>

                <small id='oERyz'></small><noframes id='oERyz'>

                <i id='oERyz'><tr id='oERyz'><dt id='oERyz'><q id='oERyz'><span id='oERyz'><b id='oERyz'><form id='oERyz'><ins id='oERyz'></ins><ul id='oERyz'></ul><sub id='oERyz'></sub></form><legend id='oERyz'></legend><bdo id='oERyz'><pre id='oERyz'><center id='oERyz'></center></pre></bdo></b><th id='oERyz'></th></span></q></dt></tr></i><div id='oERyz'><tfoot id='oERyz'></tfoot><dl id='oERyz'><fieldset id='oERyz'></fieldset></dl></div>
                <tfoot id='oERyz'></tfoot>

                  <legend id='oERyz'><style id='oERyz'><dir id='oERyz'><q id='oERyz'></q></dir></style></legend>

                1. 本文介绍了WPF中类似访问的数据导航?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在 XAML/C# 中的访问表单中构建数据导航的最佳方式是什么?

                  What would be the best way to build a data-navigation like in access-forms in XAML/C#?

                  我是否应该构建一个用户控件(甚至是自定义控件),然后将其绑定到我的集合中,以便在其中放置其他控件?(因此这个问题:C# User Control that can包含其他控件(使用时))

                  Should I build a user control (or even custom control) that I just bind to my collection in which I can put other controls? (hence this question: C# User Control that can contain other Controls (when using it) )

                  或者我可以通过某种方式从 ItemsControl 派生来构建一些东西吗?怎么样?

                  Or can I build something by deriving from then ItemsControl somehow? how?

                  或者今天的做法会完全不同(比如这种导航方式在去年是如此!")?

                  Or would this be done completely different today (like "this style of navigation is so last year!")?

                  我对 C# 和所有东西都比较陌生(不是这样编程,而是更像家庭主妇语言"Access-VBA),而且我不是以英语为母语的人.所以请温柔=)

                  I'm relatively new to C# and all (not programming as such, but with more like "housewife-language" Access-VBA) also I'm no native english speaker. So pls be gentle =)

                  推荐答案

                  您可以创建用户控件并在其中放置一堆按钮(First、Prev、Next、Last 等)并将其放置在主窗口上.其次,您可以将数据导航用户控件绑定到 CollectionViewSource,这将帮助您在数据之间导航.

                  You can create user control and place a bunch of buttons (First, Prev, Next, Last, etc..) in it and place it on the main window. Secondly, you can bind your data navigation user control to a CollectionViewSource which will help you to navigate among your data.

                  您的主窗口:

                  <Window.Resources>
                      <CollectionViewSource x:Key="items" Source="{Binding}" />
                  </Window.Resources>
                  <Grid>
                      <WpfApplication1:DataNavigation DataContext="{Binding Source={StaticResource items}}" />
                      <StackPanel>
                          <TextBox Text="{Binding Source={StaticResource items},Path=Name}" />
                      </StackPanel>
                  </Grid>
                  

                  您的数据导航用户控件:

                  Your Data Navigation User Control:

                  <StackPanel>
                      <Button x:Name="Prev" Click="Prev_Click">&lt;</Button>
                      <Button x:Name="Next" Click="Next_Click">&gt;</Button>
                      <!-- and so on -->
                  </StackPanel>
                  

                  您的点击处理程序如下所示:

                  And your click handlers goes like this:

                  private void Prev_Click(object sender, RoutedEventArgs e)
                  {
                      ICollectionView view = CollectionViewSource.GetDefaultView(DataContext);
                      if (view != null)
                      {
                          view.MoveCurrentToPrevious();
                      }
                  }
                  

                  我希望这会有所帮助.

                  这篇关于WPF中类似访问的数据导航?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Windows Phone 8 页面之间的导航问题 下一篇:寻找适用于桌面应用程序的 Visual Studio 工具箱样

                  相关文章

                  最新文章

                    <tfoot id='m1mWQ'></tfoot>
                    1. <legend id='m1mWQ'><style id='m1mWQ'><dir id='m1mWQ'><q id='m1mWQ'></q></dir></style></legend>
                      <i id='m1mWQ'><tr id='m1mWQ'><dt id='m1mWQ'><q id='m1mWQ'><span id='m1mWQ'><b id='m1mWQ'><form id='m1mWQ'><ins id='m1mWQ'></ins><ul id='m1mWQ'></ul><sub id='m1mWQ'></sub></form><legend id='m1mWQ'></legend><bdo id='m1mWQ'><pre id='m1mWQ'><center id='m1mWQ'></center></pre></bdo></b><th id='m1mWQ'></th></span></q></dt></tr></i><div id='m1mWQ'><tfoot id='m1mWQ'></tfoot><dl id='m1mWQ'><fieldset id='m1mWQ'></fieldset></dl></div>

                      <small id='m1mWQ'></small><noframes id='m1mWQ'>

                        <bdo id='m1mWQ'></bdo><ul id='m1mWQ'></ul>