Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ComboBox binding to self
Message
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Divers
Thread ID:
01286103
Message ID:
01286473
Vues:
38
>
{RelativeSource Self}
can't work in this particular case as your path changes it's value dynamically ;-)

Don't see why it can't work. In fact this works fine:
<ComboBox Width="Auto" Height="Auto" IsSynchronizedWithCurrentItem="True" x:Name="ComboBox" IsDropDownOpen="False" SelectedIndex="0">
   <ComboBox.Foreground>
         <Binding Path="SelectedItem.Foreground">
                <Binding.RelativeSource>
                      <RelativeSource Mode="Self"/>
                </Binding.RelativeSource>
         </Binding>
    </ComboBox.Foreground>
    <ComboBoxItem Content="Apples" Foreground="Red" />
    <ComboBoxItem Content="Oranges" Foreground="Orange"/>
    <ComboBoxItem Content="Pears" Foreground="Green"/>
</ComboBox>
'Longhand' version but it could be stated as an attribute of ComboBox. But admittedly it's a far more convoluted solution than yours <s>
Regards,
Viv
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform