473,583 Members | 4,510 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:Syste m;assembly=msco rlib" 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:DateTimeel ements. I get a compiler warning
on these saying that StackPanel has "invalid" child elements. The code will
not run.

If I put the <sys:DateTimeel ements 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:DateTimere cognized? What am I doing wrong here?

BBM
Nov 15 '07 #1
4 2875
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
3900
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
1287
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 make XAML related tools (runtime and editors) available to developers? I heard the only way to work with XAML with C# today is to install the...
11
285
by: Ioannis Vranos | last post by:
Will XAML be mandatory in VS "Orcas"? -- Ioannis Vranos
4
2654
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 or win applications will be different? Or will future versions of VS.Net wrap up the XAML hence making it unnecessary for me to know or learn XAML?...
3
1922
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 excited as you could put a lot of 3d effects in your apps. Who is with me in thinking that xaml is kind of green right now. Maybe tools will be added...
4
17917
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: <UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary
8
15938
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: Cannot create instance of 'Page1' defined in assembly 'ArcForex.com, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown...
0
4328
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 "Promena". I change content of property "Promena" from "Origin text" to "Changed text" using thread but content of label is still the same - databinding isn´t...
0
7894
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7825
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7933
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8191
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3816
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3841
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1431
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1155
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.