![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Templated ComboBox fires SelectionChanged twice I have a combobox that I styled to have another combo box inside it (to add some visual functionality). However, because I have two combos (the logical and the visual) that are two-way bound to one another, when I make a selection, the SelectionChanged event fires twice. I'm not sure how to mask the event when it's triggered via a binding outside taking my custom template out altogether, which isn't an option: <Style x:Key="PickList" TargetType="{x:Type ComboBox}"> <Setter Property="MinWidth" Value="150"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ComboBox}"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="19"/> </Grid.ColumnDefinitions> <ComboBox Grid.ColumnSpan="2" ItemsSource="{TemplateBinding ItemsSource}" ItemTemplate="{TemplateBinding ItemTemplate}" SelectedItem="{Binding RelativeSource={x:Static RelativeSource.TemplatedParent}, Path=SelectedItem, Mode=TwoWay}" MinHeight="{TemplateBinding MinHeight}" MinWidth="{TemplateBinding MinWidth}"/> <Border Margin="2,2,2,1" I****TestVisible="False"> <StackPanel Name="SelectLabel" Visibility="Hidden" Orientation="Horizontal" HorizontalAlignment="Center" Margin="{TemplateBinding Control.Padding}"> <TextBlock Style="{StaticResource PickListNullItem}" Text="Select a "/> <TextBlock Style="{StaticResource PickListNullItem}" Text="{TemplateBinding Name}"/> </StackPanel> </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property="SelectedItem" Value="{x:Null}"> <Setter Property="Visibility" Value="Visible" TargetName="SelectLabel"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Windows Defender: Event 3004 never fires | ruisu | Vista security | 0 | 08-22-2008 06:53 PM |
| Is there an event that real fires for sure only once UserControl L | Schwartzenberg | Avalon | 3 | 05-23-2008 06:21 AM |
| Mnemonics in WPF ComboBox | Oleg Ogurok | Avalon | 0 | 10-16-2007 02:04 PM |
| Custom Combobox in WPF | askaile | Avalon | 2 | 09-24-2007 02:47 AM |
| ComboBox Problem | Bahadýr ARSLAN | Avalon | 0 | 08-20-2007 01:47 AM |