Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Organising resources
Message
 
 
À
02/03/2009 05:56:42
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Divers
Thread ID:
01384902
Message ID:
01385061
Vues:
34
Unrelated question. In US it's organizing. I believe I discussed it before with Terry, is it 'organising' in UK ?

>Hi,
>
>I'm looking at general design for a WPF application. There seems to be plenty of reading on property and style inheritance, user controls etc but very little on strategies for pulling the whole thing together as a type of framework. To get a feel for what can be done I've created a UserControl which wraps a couple of elements plus a button. The buttons click is used to raise a 'Clicked' event at the control level. Now I might need to use this as, say, a DataTemplate in a ListBox. So in Window.Resources I wrap it in a Style so:
><Style x:Key="RectTemplate" TargetType="ItemsControl">
>  <Setter Property="ItemsControl.ItemTemplate">
>    <Setter.Value>
>      <DataTemplate>
>        <loc:TestListItem x:Name="TLI" Clicked="TestListItem_Clicked" />
>      </DataTemplate>
>    </Setter.Value>
>  </Setter>
> </Style>
and then use it for a Listbox:
<ListBox Grid.Row="1" Name="listBox1"  Style="{StaticResource RectTemplate}" SelectionMode="Extended"
>      HorizontalContentAlignment="Stretch">
></ListBox>
So far so good - everything works fine. But say that I now want to move the Style definition to an external or application level resource dictionary. The Clicked event handler can't now be hooked up because it is not in scope. So how can I hook it up in the Listbox on the form (even in code behind)?
>Or is there a better way of architecting this sort of thing?
>Regards,
>Viv
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform