|
What are the steps to reproduce the error on the uploaded app?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am now using a new class based on the code you supplied. This has enabled me to get rid of my "kludge." It works in case I only need to add new metadata items but not in case I have to copy the entire BitmapMetadata object from one image to another. That remains a profound mystery and Microsoft has not responded to my Connect inquiry, probably because it involves a bug in a release product (.NET 3.5) and I don't think Microsoft owns up to those.
|
|
|
|
|
Hi
I recently got it working to bind my XML document to my treeview by doing the following in the code behind file:
XDocument doc = XDocument.Load("path\\dsCurrent.xml");
_treeView.DataContext = doc;
and the following in the XAML:
<Window.Resources><br />
<HierarchicalDataTemplate ItemsSource="{Binding Path=Elements}" x:Key="TVTemplate"><br />
<TreeViewItem Header="{Binding Path=Name}"/><br />
<!--<TreeViewItem Header="{Binding Path=Attribute[Title].Value}"/>--><br />
</HierarchicalDataTemplate><br />
</Window.Resources><br />
<StackPanel><br />
<TreeView x:Name="_treeView" ItemsSource="{Binding Path=Root.Elements}" ItemTemplate="{StaticResource TVTemplate}"/><br />
</StackPanel>
Now my XML file looks like this:
- <Shippers><br />
<ShipperID>1</ShipperID> <br />
<CompanyName>Speedy Express</CompanyName> <br />
<Phone>(503) 555-9831</Phone> <br />
- <Orders><br />
<OrderID>10249</OrderID> <br />
<CustomerID>TOMSP</CustomerID> <br />
<EmployeeID>6</EmployeeID> <br />
<OrderDate>1994-08-05T00:00:00+02:00</OrderDate> <br />
<RequiredDate>1994-09-16T00:00:00+02:00</RequiredDate> <br />
<ShippedDate>1994-08-10T00:00:00+02:00</ShippedDate> <br />
<ShipVia>1</ShipVia> <br />
<Freight>11.61</Freight> <br />
<ShipName>Toms Spezialitäten</ShipName> <br />
<ShipAddress>Luisenstr. 48</ShipAddress> <br />
<ShipCity>Münster</ShipCity> <br />
<ShipPostalCode>44087</ShipPostalCode> <br />
<ShipCountry>Germany</ShipCountry> <br />
- <_x005B_Order_x0020_Details_x005D_><br />
<OrderID>10249</OrderID> <br />
<ProductID>14</ProductID> <br />
<UnitPrice>18.6</UnitPrice> <br />
<Quantity>9</Quantity> <br />
<Discount>0</Discount> <br />
</_x005B_Order_x0020_Details_x005D_>
When I start the app, my treeview gets created correctly, except it does not put the actual ShipperID value in as the name of the node, it shows "SupplierID". This is the same for all the nodes. How can I bind the Header of the treeview items so that it shows the values? I tried binding the header to Value but it then shows a whole bunch of information. How can I select specifically which value to set as the header for the treeview items?
|
|
|
|
|
Etienne_123 wrote: t does not put the actual ShipperID value in as the name of the node, it shows "SupplierID". This is the same for all the nodes. How can I bind the Header of the treeview items so that it shows the values?
Maybe bind to Value instead of Name?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I actually said in the last part of my messge that I've tried that, but it then shows the shipperID, name, address all together. Is there anything else I can bind to? How can I specify which field I want to bind to? Or would I have to use XPath. But then another question arises, if the xml is not included in my xaml file within a XmlDataProvider, how do I use XPath on an external xml file?
|
|
|
|
|
Etienne_123 wrote: I actually said in the last part of my messge that I've tried that, but it then shows the shipperID, name, address all together
Something was incorrect then.
Etienne_123 wrote: Is there anything else I can bind to?
Sure - I gave you this link in the first thread you posted on this topic:
How to: Bind to XDocument, XElement, or LINQ for XML Query Results[^]
You may have to follow links from that page "To learn more"...
Etienne_123 wrote: if the xml is not included in my xaml file within a XmlDataProvider, how do I use XPath on an external xml file?
I believe I've mentioned XmlDataDocument in a previous post. Or maybe its base class
XmlDocument. Or other sources - Binding Sources Overview[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
I'm using a typed dataset in my WPF app which was generated for me by adding a new data source via the visual studio wizard. My problem is, when I call the WriteXml
method on my dataset (e.g. dsDemo.WriteXml) it creates an XML file yes, but the only thing in the XML file is the following:
<?xml version="1.0" standalone="yes" ?>
<_Workstation_aXYZDataSet xmlns="http://tempuri.org/_Workstation_aXYZDataSet.xsd" />
Why does it not show all my table data?
|
|
|
|
|
This question has absolutely nothing to do with WPF, and you've cross posted in the C# forum. Please don't do this - it's really bad form.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi,
I want to use Number updown control in my WPF application. BUt I didn't found any such control in the toolbox control. Please tell me how can i implement this control and its functionality in my application
If any one have idea on this please reply me.
Thanks in advance.
|
|
|
|
|
There is no NumericUpDown control for WPF inherently available (as far as I know). But you can always use the Winform NumericUpDown control (using a WindowsFormsHost[^]).
Take a look at this sample on MSDN[^].
|
|
|
|
|
I developed a UserControl for a spinner composed of an edit box and a vertical scroll bar. To make it general enough required 400 lines of code but it has proved to be so useful that I've employed it in dozens of different places in my application and it has given me enormous payback. So just read a book explaining how to develop your own UserControl. Knowing how to do this should be knowledge at the fingertips of every WPF programmer anyhow. It's simply part of being a WPF programmer and Microsoft is right about not supplying dozens of little gizmos that would be "nice to have" when the framework itself has been so carefully designed for developers to "roll their own."
|
|
|
|
|
Hi,
I am working on a silver light application. In this I want to use a web browser control like functionality. That is I want to open a new browser dynamically at run time to open a new web link. I tried in many ways using the normal syntax but they didn't worked with my application. please note that I am using Silver light 2.0
If any one have any idea on this please reply me.
Thanks in advance.
|
|
|
|
|
Nekkantidivya wrote: I want to open a new browser dynamically at run time to open a new web link.
Did you ask this before?[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi
I know probably should've posted this on the XML message boards, but no one seems to reply there.
I have a database with 3 tables; Customers, Orders, and Order Details. The relationships between the tables are set up correctly; A Customer can have many Orders and a Order can have many Order Details. I added this database via the 'Add New Data Source' wizard om Visual Studio. I then use the following line of code to create an XML document from the dataset (dsNWind2k):
dsNWind2k.Customers.WriteXml("path\\asd.xml", true);
The 'true' is for 'writeHierarchy' which specifies that it will convert the Customers table to XML as well as all it's decendants. Now this is exactly what it does, except it doesn't give me a hierarchical xml structure the way I want it to. Instead, it converts all the fields in the Customers table to XML, then directly underneath that it generates the Orders. and once again underneath the Orders, the Order Details.
Is there a way to have it generate all the Customers, then within each Customer it should display the Orders associated with that specific Customer, and then within each Order it should display the Order Details associated with that specific Order.
Here's a sample of what it does at the moment:
..more customers..<br />
..more customers..<br />
<Customers><br />
<CustomerID>NORTS</CustomerID> <br />
<CompanyName>North/South</CompanyName> <br />
<ContactName>Simon Crowther</ContactName> <br />
<ContactTitle>Sales Associate</ContactTitle> <br />
<Address>South House 300 Queensbridge</Address> <br />
<City>London</City> <br />
<PostalCode>SW7 1RZ</PostalCode> <br />
<Country>UK</Country> <br />
<Phone>(171) 555-7733</Phone> <br />
<Fax>(171) 555-2530</Fax> <br />
</Customers><br />
..more customers..<br />
..more customers..<br />
<br />
..more orders..<br />
..more orders..<br />
<Orders><br />
<OrderID>10614</OrderID> <br />
<CustomerID>BLAUS</CustomerID> <br />
<EmployeeID>8</EmployeeID> <br />
<OrderDate>1995-08-29T00:00:00+02:00</OrderDate> <br />
<RequiredDate>1995-09-26T00:00:00+02:00</RequiredDate> <br />
<ShippedDate>1995-09-01T00:00:00+02:00</ShippedDate> <br />
<ShipVia>3</ShipVia> <br />
<Freight>1.93</Freight> <br />
<ShipName>Blauer See Delikatessen</ShipName> <br />
<ShipAddress>Forsterstr. 57</ShipAddress> <br />
<ShipCity>Mannheim</ShipCity> <br />
<ShipPostalCode>68306</ShipPostalCode> <br />
<ShipCountry>Germany</ShipCountry> <br />
</Orders><br />
..more orders..<br />
..more orders..<br />
<br />
..more order details..<br />
..more order details..<br />
<Order_x0020_Details><br />
<OrderID>10599</OrderID> <br />
<ProductID>62</ProductID> <br />
<UnitPrice>49.3</UnitPrice> <br />
<Quantity>10</Quantity> <br />
<Discount>0</Discount> <br />
</Order_x0020_Details><br />
..more order details..<br />
..more order details..
This becomes a problem when I want to bind this XML to my TreeView in WPF, because now Orders and Order Details will become Parent nodes, BUT I want it to be displayed as child nodes underneath Customers
Hope someone can help me
|
|
|
|
|
Take a look at the XmlDataDocument class instead of using DataSet.WriteXml()
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hi,
I am new to silverlight, and have a little problem!
I basically want to have a button and a textbox, and when the user presses the button it links to google and does a search on the text in the text box, so it calls
"www.google.co.uk/search?q=" + TextBoxText
The problem is when i put somthing like c# in the textbox, the # gets ignored.
Mark
|
|
|
|
|
The problem here is that your querystring text is actually malformed. C# is actually c%23 as far as a querystring goes. What you need to do is UrlEncode the text - you can use HttpUtility.UrlEncode(TextBoxText); to encode it (needs a reference to System.Web).
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thanks
|
|
|
|
|
You are welcome.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi,
I am working on a WPF application. In this I have to set scrolling property for canvas.
If any one have any idea how to do this please reply me.
Thanks in advance.
|
|
|
|
|
Are you sure you really want to do this for a Canvas? Inherently, a Canvas has no layout characteristics and it sounds like you're laying yourself open to a whole world of hurt here. Could you not use a Grid and set the Margins of the objects on the grid as appropriate? For instance:
<ScrollViewer HorizontalScrollBarVisibility="Auto">
<Grid Background="Green">
<!-- Layout items here as appropriate -->
</Grid>
</ScrollViewer>
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
If scrolling is required, I would think a properly oriented StackPanel would be better than a Grid .
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
The interweb is abuzz today with rumors...
Silverlight 3 RTW in July!!
One such rumor[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
'Tis July 10th, not the 3rd according to my sources inside MS.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|