DESIGNER WRITTEN CODE:
</Window.Resources>
<Style x:Key="LinkButton" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<TextBlock
Foreground="Blue"><Underline>
<ContentPresenter />
</Underline></TextBlock>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<//Window.Resources>
DEVELOPER CODE:
<Button Style="{StaticResource LinkButton}"
Click="DeveloperFunctionHere">Button Title</Button>
Code-Behind Handler code...
------------------------------------------------------------------
In the above, the designer can do whatever they want to with the visual
style, and it won't have any effect on the code-behind. They can even go
as far as to use triggers, animation timelines, and many other things to
provide a unique look, feel, & reaction to whatever they want...with no
effect on the code-behind or event handling.
-----Original Message-----
From: Graham Allwood [mailto:gravy@newsgroups.nospam]
Posted At: Monday, August 08, 2005 6:58 AM
Posted To: microsoft.public.windows.developer.winfx.avalon
Conversation: Declarative forms using Xaml
Subject: Declarative forms using Xaml
Hi all,
I have been doing a bit of thinking around declarative forms using Xaml
and
I can't seem to get my head around one issue (I'm sure there will be
more
though!!).
I thought the idea behind Xaml was that the UI design and the UI Code is
separated thus allowing a graphics designer / artist to play around with
the
look of the form and the developer to concentrate on code behind. Based
on
this assumption I was thinking: How would the button handlers be dealt
with?
Take for example a button on a page. The developer would write a click
handler for the button. Now, when the graphics designers seems the form,
they decide that rather than a button being used, they want to use a
LinkButton. A standard button and a link button have different delecate
types, so now the link button click event could not be handled by the
original click event the developer provided.
Are they some fundamentals I'm missing? Or is it expected that once a
graphics designer 'gets they hands' on the UI it will no longer work
with
the code behind?
Thanks for any advice
Graham
|