本文介绍了C#WPF中的绑定导航器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我是WPF的新手。我需要一个绑定导航器来浏览我的数据网格中的记录。怎么做。我无法在任何地方找到合适的教程 我尝试过: < pre > StackPanel x:Name =bindingNavOrientation =Horizo​​ntalMargin =2,2,221.667,0Height =29VerticalAlignment =Top> < 按钮 名称 = btnFirst 内容 = |◄ 宽度 = 30 / > < 按钮 名称 = btnPrev 内容 = ◄ 宽度 = 30 / > < TextBox x:名称 = txtdisplay Horizo​​ntalAlignment = Left 高度 = 36 TextWrapping = 换行 文字 = TextBox VerticalAlignment = Top 宽度 = 71 / > < TextBox x:名称 = txtcount Horizo​​ntalAlignment = 左 高度 = 36 TextWrapping = 换行 文字 = TextBox VerticalAlignment = 顶部 宽度 = 47 / > < 按钮 名称 = btnNext 内容 = ► 宽度 = 30 / > < 按钮 姓名 = btnLast 内容 = ►| 宽度 = 30 / > < 按钮 名称 = btnAddnew 内容 = + 宽度 = 30 / > < 按钮 名称 = btnrecordDelete 内容 = X 宽度 = 30 / > < ; / StackPanel > 我尝试使用stackpanel中的按钮进行创建。但我不知道如何绑定到datagrid。解决方案 数据网格中的导航(通过按钮)包括更改选定的索引。 /> 导航器通常与表单相关联,因为它没有内置导航,而数据网格则为。 当人们已经可以点击和/或滚动导航(更有效率)时,为什么会有按钮呢? 和你有没有想过排序列以及导航器如何处理它? I am new to WPF. I need a binding navigator to navigate through records in my datagrid. How to do it. I couldn't find a proper tutorial anywhereWhat I have tried:<pre>StackPanel x:Name="bindingNav" Orientation="Horizontal" Margin="2,2,221.667,0" Height="29" VerticalAlignment="Top"> <Button Name="btnFirst" Content="|◄" Width="30" /> <Button Name="btnPrev" Content="◄" Width="30" /> <TextBox x:Name="txtdisplay" HorizontalAlignment="Left" Height="36" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="71" /> <TextBox x:Name="txtcount" HorizontalAlignment="Left" Height="36" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="47"/> <Button Name="btnNext" Content="►" Width="30"/> <Button Name="btnLast" Content="►| " Width="30"/> <Button Name="btnAddnew" Content="+" Width="30"/> <Button Name="btnrecordDelete" Content="X" Width="30" /> </StackPanel>I tried creating with buttons in a stackpanel. But I couldn't know how to bind to datagrid. 解决方案 "Navigating" in a datagrid (via buttons) consists of changing the "selected index".A "navigator" is typically associated with a "form", because it has no "built-in" navigation, while a datagrid DOES.Which begs the question of why have buttons when one can already click and / or scroll to navigate (more efficiently)?And have you thought of "sorted" columns and how a "navigator" would deal with that? 这篇关于C#WPF中的绑定导航器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-30 07:41