Salakhetdinov Shamil
mcp2004 at mail.ru
Thu May 28 03:14:29 CDT 2009
Hi All, Let's start WPF buttons styling exercizes - here is a web page, which should display three stacked buttons when loaded into IE 7/8 or FireFox 3.x on MS Windows Vista, and I guess on latest Windows XP SP3(?) - but I haven't tested that latter: http://shamils-4.hosting.parking.ru/wpf/SpecialButtonStyle1.xaml The following is the above web page's xaml - it is given just for starters to define/test what are the target platforms for which this exersize can be tested online - the next samples will augment this .xaml page with styling. I should note that AFAIK the usage of .xaml pages' styling that way online is rather limited because this page/application is running in sandbox, which makes many WPF/XAML features unavailable because of secutiry reasons. For example <DropShadowEffect> will not work on this page (I don't know yet/I guess that activation on <DropShadowEffect> for this page can be done by using accompanying manifest file - anybody to approve/disapprove?) Anyway we should be able to make visually attractive buttons even in this limited sandbox context: when done those styles can be reused in WPF, XBAP and SilverLight applications. Let's start: <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Sample Buttons" Height="200" Width="300"> <Page.Resources> <Style x:Key="specialButton" TargetType="{x:Type Button}" /> </Page.Resources> <StackPanel Orientation="Vertical"> <Button Style="{StaticResource specialButton}" Content="Foo" /> <Button Style="{StaticResource specialButton}" IsDefault="True" Content="Bar" Margin="0,5,0,5" /> <Button Style="{StaticResource specialButton}" IsEnabled="False" Content="Baz" /> </StackPanel> </Page> It's rather obvious(?) what elements the above page defines - if not please post your questions here. The next step could be to define the buttons width and height and to draw the shape of the buttons: their shape can be literally any - let's start simple - a rectangle with rounded corners - almost as standard buttons you currently see but the button shape will be custom-drawn to demonstrate the principle of shaping WPF controls. If you have any ideas what simple shape would be better to use in this exersize instead of rounded rectangle please post your notes here. Thank you. -- Shamil