Can Someone hazard a guess?
-
...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of
Label.Text
, we haveLabel.Content
, and instead ofControl.Enable
, we gotControl.IsEnabled
. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened toApplication.StartupPath
in .Net 3.5? And imagine my surprise to find out that I have to use theDispatchTimer
class instead of theSystem.Timers.Timer
class..."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/2001John Simmons / outlaw programmer wrote:
Instead of Label.Text, we have Label.Content
The WPF equivalent of the WinForms Label control is actually TextBlock (which has a Text property). The WPF Label is actually a heavier more complex control - so wherever you used a Label in WinForms, in WPF you should be using TextBlock.
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link -
in that case; because datagrid was a steaming pile of fail and they wanted to make as clean break as possible.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall
So what do you use instead of Datagrid?
-
John Simmons / outlaw programmer wrote:
Instead of Label.Text, we have Label.Content
The WPF equivalent of the WinForms Label control is actually TextBlock (which has a Text property). The WPF Label is actually a heavier more complex control - so wherever you used a Label in WinForms, in WPF you should be using TextBlock.
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com linkNishant Sivakumar wrote:
The WPF equivalent of the WinForms Label control is actually TextBlock (which has a Text property). The WPF Label is actually a heavier more complex control - so wherever you used a Label in WinForms, in WPF you should be using TextBlock.
SO why not have the new heavier control called TextBlock a new name not used before! Why confuse what everyone knows to be the standard!
-
...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of
Label.Text
, we haveLabel.Content
, and instead ofControl.Enable
, we gotControl.IsEnabled
. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened toApplication.StartupPath
in .Net 3.5? And imagine my surprise to find out that I have to use theDispatchTimer
class instead of theSystem.Timers.Timer
class..."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/2001John Simmons / outlaw programmer wrote:
of Label.Text, we have Label.Content
Presumably becuase it can (or might in the future) have "non-text" stuff in it (HTML etc) *
John Simmons / outlaw programmer wrote:
instead of Control.Enable, we got Control.IsEnabed
This one makes sense to me. Enable is a verb (method) wheras IsEnabled is a state (property) * I don't do any WPF work, so the control may already support formatted content for all I know.
-
...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of
Label.Text
, we haveLabel.Content
, and instead ofControl.Enable
, we gotControl.IsEnabled
. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened toApplication.StartupPath
in .Net 3.5? And imagine my surprise to find out that I have to use theDispatchTimer
class instead of theSystem.Timers.Timer
class..."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/2001John Simmons / outlaw programmer wrote:
Instead of Label.Text, we have Label.Content
That's because the Label is not restricted to only to text. It can contain arbitary content.
John Simmons / outlaw programmer wrote:
instead of Control.Enable, we got Control.IsEnabled.
No idea on that one.
John Simmons / outlaw programmer wrote:
WTF happened to Application.StartupPath in .Net 3.5?
It's there. You need to look at the right "Application".
John Simmons / outlaw programmer wrote:
that I have to use the DispatchTimer class instead of the System.Timers.Timer class...
For the same reason you had to use System.WIndows.Timer in windows forms or use SetTimer in MFC (as opposed to CreateTimerQueuTimer).
-
...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of
Label.Text
, we haveLabel.Content
, and instead ofControl.Enable
, we gotControl.IsEnabled
. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened toApplication.StartupPath
in .Net 3.5? And imagine my surprise to find out that I have to use theDispatchTimer
class instead of theSystem.Timers.Timer
class..."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/2001It is because composition is a big part of WPF. Between a WPF label's opening and closing tag you can have not only text but any content like images etc. Therefore a property name of Content makes more sense.
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand -
John Simmons / outlaw programmer wrote:
Instead of Label.Text, we have Label.Content
That's because the Label is not restricted to only to text. It can contain arbitary content.
John Simmons / outlaw programmer wrote:
instead of Control.Enable, we got Control.IsEnabled.
No idea on that one.
John Simmons / outlaw programmer wrote:
WTF happened to Application.StartupPath in .Net 3.5?
It's there. You need to look at the right "Application".
John Simmons / outlaw programmer wrote:
that I have to use the DispatchTimer class instead of the System.Timers.Timer class...
For the same reason you had to use System.WIndows.Timer in windows forms or use SetTimer in MFC (as opposed to CreateTimerQueuTimer).
Rama Krishna Vavilala wrote:
It's there. You need to look at the right "Application".
Rama, do you mean the one in System.Windows? If so, it doesn't have a StartupPath property. Or is there a different one available in some other assembly/namespace?
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link -
...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of
Label.Text
, we haveLabel.Content
, and instead ofControl.Enable
, we gotControl.IsEnabled
. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened toApplication.StartupPath
in .Net 3.5? And imagine my surprise to find out that I have to use theDispatchTimer
class instead of theSystem.Timers.Timer
class..."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/2001John Simmons / outlaw programmer wrote:
And while I'm complaining, WTF happened to Application.StartupPath in .Net 3.5?
You can still use it - but you have to add a reference to System.Windows.Forms - it's a Forms method.
"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.
-
Rama Krishna Vavilala wrote:
It's there. You need to look at the right "Application".
Rama, do you mean the one in System.Windows? If so, it doesn't have a StartupPath property. Or is there a different one available in some other assembly/namespace?
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com linkNishant Sivakumar wrote:
Rama, do you mean the one in System.Windows? If so, it doesn't have a StartupPath property. Or is there a different one available in some other assembly/namespace?
See my answer below.
"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.
-
...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of
Label.Text
, we haveLabel.Content
, and instead ofControl.Enable
, we gotControl.IsEnabled
. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened toApplication.StartupPath
in .Net 3.5? And imagine my surprise to find out that I have to use theDispatchTimer
class instead of theSystem.Timers.Timer
class..."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 -
Rama Krishna Vavilala wrote:
It's there. You need to look at the right "Application".
Rama, do you mean the one in System.Windows? If so, it doesn't have a StartupPath property. Or is there a different one available in some other assembly/namespace?
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com linkJohn is probably confused between System.Windows.Forms.Application (WinForms + has StartupPath) and System.Windows.Application (WPF). Both are different.
-
John Simmons / outlaw programmer wrote:
And while I'm complaining, WTF happened to Application.StartupPath in .Net 3.5?
You can still use it - but you have to add a reference to System.Windows.Forms - it's a Forms method.
"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.
Pete O'Hanlon wrote:
You can still use it - but you have to add a reference to System.Windows.Forms - it's a Forms method.
Nice, though I probably won't do it that way to avoid the WinForms reference. That just uses GetModuleFileName anyway.
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link -
John is probably confused between System.Windows.Forms.Application (WinForms + has StartupPath) and System.Windows.Application (WPF). Both are different.
Rama Krishna Vavilala wrote:
John is probably confused between System.Windows.Forms.Application (WinForms + has StartupPath) and System.Windows.Application (WPF). Both are different.
Ah okay. You meant that he didn't realize that this is a whole new class.
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com link -
Pete O'Hanlon wrote:
You can still use it - but you have to add a reference to System.Windows.Forms - it's a Forms method.
Nice, though I probably won't do it that way to avoid the WinForms reference. That just uses GetModuleFileName anyway.
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
My latest book : C++/CLI in Action / Amazon.com linkIndeed - I actually use this:
public static class Utility
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
public static extern int GetModuleFileName(HandleRef hModule, StringBuilder buffer, int length);private static string startupPath;
private static HandleRef NullHandleRef = new HandleRef();public static string StartupPath()
{
if (startupPath == null)
{
StringBuilder buffer = new StringBuilder(260);
GetModuleFileName(NullHandleRef, buffer, buffer.Capacity);
startupPath = Path.GetDirectoryName(buffer.ToString());
}
new FileIOPermission(FileIOPermissionAccess.PathDiscovery, startupPath).Demand();
return startupPath;
}
}God bless Reflector.
"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.
-
So what do you use instead of Datagrid?
DataGridView. DataGrid was the 1.0 framework attempt at the same. it sucked massively.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall
-
...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of
Label.Text
, we haveLabel.Content
, and instead ofControl.Enable
, we gotControl.IsEnabled
. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened toApplication.StartupPath
in .Net 3.5? And imagine my surprise to find out that I have to use theDispatchTimer
class instead of theSystem.Timers.Timer
class..."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/2001Developed by a different team. Such differences are usually a mix of different style guide lines (e.g. "All boolean properties should start with Is, Are, or Can"), different tastes ("X always irked me, I'd prefer Y"), and ignorance ("We are the cool guys, why should we know WinForms at all?")
-
DataGridView. DataGrid was the 1.0 framework attempt at the same. it sucked massively.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall
The data grid was serviceable at best. The Gridview was completely redone. Many of the changes seemed logical rather than arbitrary.
I didn't get any requirements for the signature
-
Nishant Sivakumar wrote:
The WPF equivalent of the WinForms Label control is actually TextBlock (which has a Text property). The WPF Label is actually a heavier more complex control - so wherever you used a Label in WinForms, in WPF you should be using TextBlock.
SO why not have the new heavier control called TextBlock a new name not used before! Why confuse what everyone knows to be the standard!
To see if you're actually paying attention, of course! :D
-
...as to why Microsoft saw fit to change (arbitrarily, it seems) the properties for WPF controls. Instead of
Label.Text
, we haveLabel.Content
, and instead ofControl.Enable
, we gotControl.IsEnabled
. It's almost as if they're introducing an artificial and arbitrary learning curve. Is there a book or web site that talks about the differences in ALL the controls regarding WPF vs WinForms)? And while I'm complaining, WTF happened toApplication.StartupPath
in .Net 3.5? And imagine my surprise to find out that I have to use theDispatchTimer
class instead of theSystem.Timers.Timer
class..."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/2001Winforms and WPF are different frameworks. WPF is not an upgrade or new version of winforms. Why should one act like the other in any way? The content property (like others have said) can contain more that just text so naming it Text because of some obscure relationship with a totally different framework would be crazy.
Simon
-
John Simmons / outlaw programmer wrote:
of Label.Text, we have Label.Content
Presumably becuase it can (or might in the future) have "non-text" stuff in it (HTML etc) *
John Simmons / outlaw programmer wrote:
instead of Control.Enable, we got Control.IsEnabed
This one makes sense to me. Enable is a verb (method) wheras IsEnabled is a state (property) * I don't do any WPF work, so the control may already support formatted content for all I know.
Electron Shepherd wrote:
instead of Control.Enable, we got Control.IsEnabed This one makes sense to me. Enable is a verb (method) wheras IsEnabled is a state (property)
Agreed on that, but I think John meant to say '.Enabled' vs '.IsEnabled', in which case both are clearly states. I've never come across a bool called 'Enable' on a control, but the word could server a valid purpose in the sense of a 'command' flag, meaning 'you must enable this control', vs. 'this control is enabled'.