- 浏览: 399598 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (309)
- xaml C# wpf (0)
- scala java inner clas (1)
- Tools UML Eclipse UML2 (1)
- Timer .NET Framework (1)
- perl (6)
- python function paramter (1)
- Python Docstring (1)
- Python how to compare types (1)
- Python (8)
- java (5)
- C# (76)
- C# WPF (0)
- p4 (0)
- WPF (46)
- .net (6)
- xaml (1)
- javascript (40)
- windows (10)
- scala (4)
- winform (1)
- c++ (48)
- tools (12)
- cmd (1)
- os (0)
- CI (0)
- shell (0)
- C (2)
- haskell (49)
- functional (1)
- tool (1)
- gnu (1)
- linux (1)
- kaskell (0)
- svn (0)
- wcf (3)
- android (1)
最新评论
Sometimes you may bind to some XmlDataProvider with the data provided as Xml Island. with XmlDataProvider, you may write something as follow.
<XmlDataProvider x:Key="OrderData2" XPath="Orders" > <x:XData> <!-- caveat: - see http://stackoverflow.com/questions/1899451/how-do-i-bind-to-xmldataprovider-whos-source-has-a-default-namespace-xmlns-set on how to bind XmlDataProvider with a default xmlns set --> <Orders> <Order> <ProductName>Hi-Speed Tonic</ProductName> <CostPerUnit>50.00</CostPerUnit> <Quantity>1</Quantity> <Discount>5</Discount> <ShipAndHandle>10.00</ShipAndHandle> </Order> <Order> <ProductName>TNT</ProductName> <CostPerUnit>50.00</CostPerUnit> <Quantity>10</Quantity> <Discount>5</Discount> <ShipAndHandle>10.00</ShipAndHandle> </Order> <Order> <ProductName>Jet-propelled Roller Skates</ProductName> <CostPerUnit>50.00</CostPerUnit> <Quantity>2</Quantity> <Discount>5</Discount> <ShipAndHandle>10.00</ShipAndHandle> </Order> <Order> <ProductName>Portable Hole</ProductName> <CostPerUnit>50.00</CostPerUnit> <Quantity>15</Quantity> <Discount>5</Discount> <ShipAndHandle>10.00</ShipAndHandle> </Order> <Order> <ProductName>Earthquake Pills</ProductName> <CostPerUnit>50.00</CostPerUnit> <Quantity>10</Quantity> <Discount>5</Discount> <ShipAndHandle>10.00</ShipAndHandle> </Order> <Order> <ProductName>Rocket Sled</ProductName> <CostPerUnit>50.00</CostPerUnit> <Quantity>1</Quantity> <Discount>5</Discount> <ShipAndHandle>10.00</ShipAndHandle> </Order> <Order> <ProductName>Giant Rubber Band</ProductName> <CostPerUnit>50.00</CostPerUnit> <Quantity>2</Quantity> <Discount>5</Discount> <ShipAndHandle>10.00</ShipAndHandle> </Order> </Orders> </x:XData> </XmlDataProvider>
and you can do the following to bind to the XamDataGrid,
<ig:XamDataGrid x:Name="xamDatagrid" DataSource="{Binding Source={StaticResource OrderData2}, XPath=Order}" AutoFit="True" > <ig:XamDataGrid.FieldLayoutSettings> <ig:FieldLayoutSettings AutoGenerateFields="True" /> </ig:XamDataGrid.FieldLayoutSettings> </ig:XamDataGrid>
This all good when you are viewing from the designer, you can see that the Xml child element is autogenerated as a filed to the DataGrid.
But when you run, it shows nothing, why?
The reason of nothing display when you run
The reason is because the XML data island is embedded in the xaml file, and it uses the default xmlns, which is
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
but when you do XPath binding, it will translate to the default xmlns="". so there are two choices.
choice 1.
force the xml island to use the default empty xmlns, you can do this
<Orders xmlns=""> <Order> ... </Order> </Orders>
choice 2.
you can use the XmlNamespaceManager in the XmlDataProvider. like this,
<XmlDataProvider x:Key="OrderData2" XPath="/fb:Orders" > <XmlDataProvider.XmlNamespaceManager> <XmlNamespaceMappingCollection> <XmlNamespaceMapping Uri="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Prefix="fb" /> </XmlNamespaceMappingCollection> </XmlDataProvider.XmlNamespaceManager> <x:XData> <Orders> <!-- the same as above --> </Orders> </XmlDataProvider>
and in the XamDataGrid, in the DataSource binding parts, do this:
<ig:XamDataGrid x:Name="xamDatagrid" DataSource="{Binding Source={StaticResource OrderData2}, XPath=fb:Order}" AutoFit="True" > ... <?ig:XamDataGrid>
you will notice the fb as in
XPath=fb:Order
发表评论
-
wpf - example to enhance ComboBox for AutoComplete
2014-09-19 15:56 1976first let’s see an example ... -
Investigate and troubleshoot possible memory leak issue of .NET application
2014-07-31 10:42 0Hi All, I would like to sh ... -
C# – CoerceValueCallback合并、替换元数据值
2013-08-05 21:59 1925Topic: C# – CoerceValueCallbac ... -
WPF – Virtualization – VirutalizationStackPanel and ItemsPanelTemplate
2013-08-05 21:55 1410Topic: WPF – Virtualization – ... -
wpf – ListView交替背景色
2013-07-02 20:56 6551Wpf – Alternate background col ... -
C# - 简单介绍TaskScheduler
2013-06-29 17:18 12038标题: C# - 简单介绍TaskSchedulerTit ... -
c# - Get enum from enum attribute
2013-06-27 21:32 1244DescriptionAttribute gives the ... -
C# - PInvoke, gotchas on the RegisterClassEx and the CreateWindowEx
2013-06-24 13:49 2571I get an exception message li ... -
c# - Use PInvoke to create simple win32 Application
2013-06-24 11:59 10946In this post, .net platform h ... -
c# - Linq's Select method as the Map function
2013-06-19 18:47 1287If you comes from a functiona ... -
c# - Tips of Linq expression Any to determine if a collection is Empty
2013-06-19 18:29 938When you are @ the linq expres ... -
myth buster - typeof accepting array of types not acceptable
2013-06-19 17:17 813I have seen from some book whe ... -
windows - trying to create WIN32 application with PInvoke
2013-06-19 14:34 0While it is stupid to do such ... -
wpf - BehaviorBase and one use examples
2013-06-18 18:41 1311Behavior is something that we ... -
WPF - Setting foreground color of Entire window
2013-06-13 16:00 1918You might as well as I would s ... -
WPF - Enhanced TabControl - TabControlEx aka Prerendering TabControl
2013-06-13 13:12 5330As an opening word, let's che ... -
wpf - ControlTemplate and AddLogicChild/RemoveLogicalChild
2013-06-10 15:42 1185Recently I was trying to debug ... -
c# - P/Invoke, DllImport, Marshal Structures and Type conversions
2013-06-05 15:25 1712P/Invoke as in the following q ... -
c# - A study on the NativeWindow - encapsulate window handle and procedure
2013-06-05 14:40 6091NativeWindow gives you a way t ... -
WCF - Notify server when client connects
2013-06-03 18:19 1221It is sometimes very importan ...
相关推荐
在Windows Presentation Foundation (WPF) 中,`XmlDataProvider` 是一个强大的工具,它允许开发者将XML数据绑定到用户界面元素,实现数据驱动的界面。这个技术对于构建动态、响应式的应用程序至关重要,因为它使得...
gong-wpf-dragdrop, GongSolutions.WPF.DragDrop 库是WPF的拖动'n'拖放框架 简介GongSolutions.WPF.DragDrop 库是一个易于使用的拖拉'n'拖放框架。特性使用 MVVM: 拖放逻辑可以放在ViewModel中。 代码不需要放在in中...
C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手
WPF的基本空间历程,使用.net core3.0.1版本
"WPF-3-Building Web Browser Applications with Windows Presentation Foundation" 这个主题专注于如何利用WPF来构建功能丰富的Web浏览器应用程序。 在WPF中,开发人员可以利用XAML(Extensible Application ...
通过深入研究WPF-Diagram-Designer的源代码(如WPF-Diagram-Designer-master文件夹中的内容),开发者不仅可以学习到如何在WPF中构建复杂的图形界面,还可以了解到图形编辑器的设计原理和实现细节,对于提升图形应用...
标题 "HMI-with-WPF-part-3-Communication-with-multiple-plc-master" 指的是一项关于使用Windows Presentation Foundation(WPF)开发人机界面(HMI)并与多个西门子PLC进行通信的项目。这个项目的重点在于通过...
“wpf---StatusBar”这个标题表明我们将探讨的是WPF(Windows Presentation Foundation)框架中的StatusBar组件。WPF是.NET Framework的一部分,用于构建桌面应用程序,它提供了丰富的用户界面(UI)功能。StatusBar...
**WPF - 强大的图表技术** Windows Presentation Foundation (WPF) 是Microsoft开发的一个用于构建桌面应用程序的框架,它提供了丰富的图形系统,包括对2D和3D图形的强大支持。在WPF中,开发人员可以利用各种图表...
在这个“wpf-datagrid-access DB”主题中,我们将深入探讨如何利用WPF Datagrid与Microsoft Access数据库进行交互,实现数据的读取、更新和保存。 1. **WPF Datagrid简介** - Datagrid是WPF中的一个数据展示控件,...
C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手 C#开发WPF-Silverlight动画及游戏系列教程-深蓝色右手
**WPF-MVVM-简单示例** 在本文中,我们将深入探讨如何使用MVVM(Model-View-ViewModel)设计模式来构建一个基于WPF(Windows Presentation Foundation)的应用程序。这个示例着重于通过操作XML数据来实现基本的CRUD...
超酷WPF数据可视化,全套源程序,非常适合做数据可视化的程序员使用,WPF,XAML。 找了好久的资源,附有很多很详细的插图,是大数据时代不可缺少的可视化学习数据,仅供大家学习使用请勿用做商业用途。与大家一起...
**WPF-WCF-WF整合开发实例** WPF(Windows Presentation Foundation)、WCF(Windows Communication Foundation)和WF(Windows Workflow Foundation)是微软.NET框架中三个关键的技术组件,它们各自负责不同的领域...
标题中的"WPF--Effect特效"指的是Windows Presentation Foundation(WPF)中的Effect特效。WPF是.NET Framework的一个重要组件,用于构建丰富的桌面应用程序。Effect特效在WPF中是用来改变UI元素外观的一...
在本篇文章中,我们将深入探讨WPF-XamlPad程序,以及与之相关的VisualTree和LogicalTree概念,还有Template的使用。 首先,让我们了解**XamlPad**。XamlPad是一个简单的编辑器,允许开发者输入纯XAML代码并即时预览...
WPF-Ribbon则是专门针对WPF平台实现的Ribbon组件,它为开发者提供了在WPF应用程序中集成这种现代用户界面的能力。 1. **Ribbon布局** - Ribbon界面通常包含多个主要区域:快速访问工具栏(QAT)、主选项卡、上下文...
gong-wpf-dragdrop-develop.rar
【标题】"File-Manager-UI-Wpf-master.7z" 涉及的是一个基于WPF(Windows Presentation Foundation)的文件管理器用户界面项目。这个压缩包包含了一个完整的开发环境,供开发者进行学习和使用。 【描述】"自用资源...