Comments are available to members only. Sign up or Log in to view these comments.
Main Topics
Browse All TopicsHi,
The basic structure of my app is:
BaseControls - generally inherit from existing MS Control and add functionality (e.g. MyTextBox)
AppControls - inherit from BaseControls and implement specific functionality (e.g. AccountNumber, AccountName)
Windows - which incorporate AppControls to create a business function.
BaseControls are WPF CustomControls with no xaml
AppControls are CustomControls with only framework xaml
Styles / Templates are in a resource dictionary at the Window level (in App.xaml) and reference the BaseControl
So for example i wish all my text boxes to be displayed with a blue border if the property IsMandatory has been set.
I create a BaseControl called MyTextBox inherited from TextBox and i add a DependencyProperty Is Mandatory
I create two controls inherited from MyTextBox called AccountNumber and AccountName and i add additional validation to each.
I place AccountNumber and AccountName on a form and set the IsMandatory Propery of each to true
In App,xaml i create a style which has a style trigger that sets the border to blue if the IsMandatory Property is set.
Now to the question - If I set the TargetType to AccountNumber then it works correctly - if I set the TargetType to MyTextBox (i.e. the type it is inherited from) then it does not work - the default TextBox is displayed.
As there are over 300 fields in this app i don't want a style for each, i just want a style for the base class
As a suplementary is this related to DefaultStyleKeyProperty.Ov
Many thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: joep_bPosted on 2008-12-24 at 14:46:18ID: 23242195
Comments are available to members only. Sign up or Log in to view these comments.