Designing with Silverlight


Set of similar reusable Buttons with different content & states


I'm having difficulty figuring out the best way to do this.
I am trying to build a set of reusable Buttons that all look alike, with the exception of a Path which could be the Content or ContentTemplate, but all behave differently.
My 1st attempt was to create a base style (BaseButtonStyle) that contained all of the Setters for my Brushes and the ControlTemplate. Then, create another style BasedOn={StaticResource BaseButtonStyle} and set the ContentTemplate to a Path. Now, I need
to animate that Path depending on the VisualState of the Button and each Button would have its own animation (Button1 rotates the Path, Button2 animates the Opacity of 2 Paths, etc....). So, I created a VisualStateGroup inside the ContentTemplate, but when
I call GoToState and pass the button & the name of that VisualState, the call returns false signifying that the VisualState doesn't exist.
Obviously I could copy the ControlTemplate to each Button's Style and add the Path and States in there, but I figure there's got to be a better way.
Would anyone like to help? Please?
Once again, thank you for your response. However, I may never get the opportunity to figure out the problem as the project has been abandoned. The reason for abandonment is the complete lack of HTML support in browser-hosted Silverlight apps.
Hi,
What you are trying should work. You'd better provide the code.
Did you add the VisualStateGroup and VisualState according to this link?
http://msdn.microsoft.com/en-us/library/cc278069(v=VS.95).aspx
Best Regards,
Shi Ding,
I have not, yet, had an opportunity to delve back into this. Hopefully, my other, more pressing, issue will get resolved & I can get back to this one.
Thanx for the response, though!
Once again, thank you for your response. However, I may never get the opportunity to figure out the problem as the project has been abandoned. The reason for abandonment is the complete lack of HTML support in browser-hosted Silverlight apps.
Never mind ~

Related Links

TextBlock Width Autosizing with wrapping in a data template
ComboBox width Binded width property is not correct????
Outlook Bar control
Silverlight and Wordpress
Is there a tutorial or video on how to do this
Map control with fill?
Is there a way to avoid this browser issue
image wrapping inside a canvas
Fonts in Silverlight
Direction??
Input and dropdown control in Silverlight
Game Ideas
Animation Triggers
Best textblock centering
MouseRightClick
Possible XAML text display bug?

Categories

MSDN
Visual Studio Languages
Visual Studio Team Fou...
DevLabs
Microsoft ISV Communit...
Smart Device Development
Windows Embedded Compact
Windows Server
Bing
Windows Hardware Devel...
Unified Communications
Archived Forums E-H
Windows Phone Preview ...
OneDrive Development
Suggestions and Feedba...
Visual Basic
Visual Studio Code Vis...
Application Insights (AI)
Tools for Apache Cordova
XboxLiveDevelopment
Media Foundation Devel...
Windows Desktop Sideba...
Windows Imaging Compon...
Excel for Developers
SharePoint 2013 - Gene...
SharePoint 2013 - Deve...
SharePoint 2010 - Setu...
SharePoint Legacy Vers...
Azure Mobile Apps
Azure Scheduler
Azure CDN
Azure Data Factory
Machine Learning
Azure Data Catalog
Azure Analysis Services
.NET Framework Class L...
Common Language Runtim...
The Forum of Sho
Debugger Canvas
Microsoft Translator U...
SQL Server Integration...
SQL Server Compact
SQL Server Samples and...
SQL Server Migration
SQL Server Master Data...
SQL Server PowerPivot ...
SQL Server Distributed...
Standard 2009: Compone...
Standard 7: Embedded E...
Standard 7: Components...
SQL Server 2012 High A...
SDK for Home Server 20...
Windows Live Messenger...
CRM Deployment
Known Issues for Windo...
SharePoint Server Prot...
Performance Profiling ...
Expression Blend + Ske...
Retired SharePoint Bus...
Retired InfoPath Forms...
.NET Framework 4 Appli...
.NET Platform Architec...
.NET Remoting and Runt...
Architecture Events
CAT.NET
Charts & Reports in th...
Deep Zoom Composer
DNS and Traffic Manager
Managed Extensibility ...
Multimap API Developme...
Search Server: Feature...
Search Server: Report ...
Silverlight (formerly ...
Software Transactional...
Surface Application De...
SQL Server 2014 SQL To...
SQL Server 2014 Setup ...
Transactions Programming
TFS Deployment to Azure
Visual Studio 2008 SP1...
Visual Studio Applicat...
Visual Studio Code Ana...
Visual Studio Gallery ...
Visual Studio WPF/SL D...
Web Sandbox - General
Kinect for Windows v1 SDK
SQL Server 2016 Preview

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile