![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | 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 | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| dataGridView CellContentClick fires after CellDoubleClick | .NET General | |||
| Serious Fires | Chillout Room | |||
| leave event fires disabling textbox below -cursor stays in 1st tex | .NET General | |||
| Windows Defender: Event 3004 never fires | Vista security | |||