473,383 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Can't access a System object in xaml

Hi,

I have this xaml code that I'm trying to use in a Window...

<ListBox xmlns:sys="clr-namespace:System;assembly=mscorlib" Grid.Column="2"
Grid.RowSpan="2">
<Button>Click for a surprise</Button>
<Expander>
Details
<StackPanel>
<sys:DateTime>1/1/2007</sys:DateTime>
<sys:DateTime>2/1/2007</sys:DateTime>
<sys:DateTime>3/1/2007</sys:DateTime>
</StackPanel>
</Expander>
</ListBox>

The problem is with the <sys:DateTimeelements. I get a compiler warning
on these saying that StackPanel has "invalid" child elements. The code will
not run.

If I put the <sys:DateTimeelements directly under the listbox (eliminating
the button and the expander), I get the same warning, but the code will run
and show the date correctly.

I'm using VS2005 with .Net 3.0 installed.

Why isn't <sys:DateTimerecognized? What am I doing wrong here?

BBM
Nov 15 '07 #1
4 2861
Hi BBM,

The StackPanel can only use UIElement as child elements. You can use a
ListBox instead:

<StackPanel>
<ListBox>
<sys:DateTime>1/1/2007</sys:DateTime>
<sys:DateTime>2/1/2007</sys:DateTime>
<sys:DateTime>3/1/2007</sys:DateTime>
</ListBox>
</StackPanel>
Hope this helps.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 16 '07 #2
Hi BBM,

I'm writing to check the status of this post. Please feel free to let me
know if there's anything else I can help. Thanks.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '07 #3

Hi Walter,

I got my code to work using your suggestions, but
could you answer my last questions?

1) Is it normal to get compiler warnings on the direct use of .Net classes
(like DateTime) from xaml? If so, why?

2) Is there a (concise) place where I can learn what items can be
"children" of other items in WPF?

Thanks.
""Walter Wang [MSFT]"" wrote:
Hi BBM,

I'm writing to check the status of this post. Please feel free to let me
know if there's anything else I can help. Thanks.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '07 #4
Hi BBM,

I'm writing to check the status of this post. Please feel free to let me
know if there's anything else I can help. Thanks.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 26 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Mark | last post by:
I'm curious to get feedback regarding the potential SVG has in performing the same functionality as PDF for fixing documents. Thanks. Mark
1
by: JDeats | last post by:
I've heard that Microsoft has decided to seperate XAML/WinFX from Longhorn and make it available before Longhorns release. If this is true, does anyone know what the timeframe is for Microsoft to...
11
by: Ioannis Vranos | last post by:
Will XAML be mandatory in VS "Orcas"? -- Ioannis Vranos
4
by: Thilaka | last post by:
Hi guys, Recently i read some articles on Longhorn & XAML. & From what i learnt the future for developing UIs lies in XAML. Does this mean that I've got to learn XAML as developing UIs for web...
3
by: Brent | last post by:
OK i downloaded the new/addon framework 3 and downloaded the VS 2005 addon. I started with XAML. So far im like mehhhhhhhh. Anyone else have the same opinion? When i first heard about xaml i got...
4
by: moondaddy | last post by:
I have a user control located in the following path: projectFolder/PropertyControls/myControl.xaml and in myControl.xaml I have a reference to a resource dictionary like this: ...
8
by: Bubbs | last post by:
I keep getting this exception when i run the program. It is driving me insane. Does anyone know whats wrong and how do i fix this! System.Windows.Markup.XamlParseException was unhandled Message:...
0
by: Czechtim | last post by:
Hello, I have problem with databinding. I created small application using structure that I need to demonstrate problem. I need to change content of label when changing content of property...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.