V
Vivien Parlat
Hello,
I hope i'm posting into the good group, i found no active group around
xaml.
My situation is the following:
I'm trying to play around xaml in the new VC# Express 2008. My
"aim" (i imagine that when i'll succeed this aim, my understanding
will be much better than now) is to create a personalized textbox,
whose background varies between : Blue (value <= 0), Yellow (value
between and 100), Red (value >= 100) or Orange (non-numeric value).
To do so I designed a UserControl, containing a TextBox (no way to
inherit from it in xaml ?), storing a converted int? value ("?"
because of cases user enters nonnumerical value), and exposing
DependancyProperties like "Hot", "Cold", and so on.
The code is as minimal as posible, because I want most of the work to
be done in another control, say "ColoredTextBox", which I want formed
as the TextBoxes in example:
http://msdn.microsoft.com/msdnmag/c.../issues/07/01/Foundations/Default.aspx?loc=fr
Initially I couldn't only see the exposed property; now, moreover, I
have errors like "Error 1 Operation is not valid due to the current
state of the object." on a line such as
<ControlTemplate x:Key="templateTextBox"
TargetType="{x:Type my:MyNumTextBox}">,
and globally I cannot find the way to create this textbox which uses
triggers on my custom properties to change the background colors.
Can anyone tell me if the way i try to do it is wrong, or how to
achieve this little control ? My only need is that it is made using
WPF, because the interest for me is to learn it, I think I could do it
easily using WinForms.
Thank you in advance (and sorry for my English) !
I hope i'm posting into the good group, i found no active group around
xaml.
My situation is the following:
I'm trying to play around xaml in the new VC# Express 2008. My
"aim" (i imagine that when i'll succeed this aim, my understanding
will be much better than now) is to create a personalized textbox,
whose background varies between : Blue (value <= 0), Yellow (value
between and 100), Red (value >= 100) or Orange (non-numeric value).
To do so I designed a UserControl, containing a TextBox (no way to
inherit from it in xaml ?), storing a converted int? value ("?"
because of cases user enters nonnumerical value), and exposing
DependancyProperties like "Hot", "Cold", and so on.
The code is as minimal as posible, because I want most of the work to
be done in another control, say "ColoredTextBox", which I want formed
as the TextBoxes in example:
http://msdn.microsoft.com/msdnmag/c.../issues/07/01/Foundations/Default.aspx?loc=fr
Initially I couldn't only see the exposed property; now, moreover, I
have errors like "Error 1 Operation is not valid due to the current
state of the object." on a line such as
<ControlTemplate x:Key="templateTextBox"
TargetType="{x:Type my:MyNumTextBox}">,
and globally I cannot find the way to create this textbox which uses
triggers on my custom properties to change the background colors.
Can anyone tell me if the way i try to do it is wrong, or how to
achieve this little control ? My only need is that it is made using
WPF, because the interest for me is to learn it, I think I could do it
easily using WinForms.
Thank you in advance (and sorry for my English) !