Bonjour,
J'ai une datagrid qui se trouve dans un template d'une combobox (dans le popup)
Le selecteditem est lié au template parent (donc la combobox) et a la combobox, j'ai bien lié le selecteditem à cette propriété:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 <Popup x:Name="PART_Popup" AllowsTransparency="True" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom"> <Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent" MaxHeight="{TemplateBinding MaxDropDownHeight}" MinWidth="{Binding ActualWidth, ElementName=MainGrid}" Height="247" Width="337"> <Border x:Name="DropDownBorder" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" Margin="0" HorizontalAlignment="Stretch" Width="Auto" Height="Auto" VerticalAlignment="Stretch"> <ScrollViewer x:Name="DropDownScrollViewer" Margin="-1" d:LayoutOverrides="VerticalAlignment"> <Grid RenderOptions.ClearTypeHint="Enabled" Background="White" Height="Auto" Width="Auto" HorizontalAlignment="Stretch"> <DataGrid x:Name="dtg_loc" Margin="0,29,0,0" Height="218" VerticalAlignment="Top" HorizontalAlignment="Left" Width="337" AutoGenerateColumns="False" ItemsSource="{TemplateBinding ItemsSource}" SelectedItem="{TemplateBinding SelectedItem}" SelectionChanged="dtg_loc_SelectionChanged" > <DataGrid.Columns> <DataGridTextColumn Binding="{Binding NIdLocalite}" Header="nIdLocalite" Visibility="Hidden" /> <DataGridTextColumn Binding="{Binding SCP}" Header="Code Postal" /> <DataGridTextColumn Binding="{Binding SLocalite}" Header="Localite" Width="200" /> <DataGridTextColumn Binding="{Binding Deal.SNom}" Header="Code Dealer" /> </DataGrid.Columns> </DataGrid> </Grid> </ScrollViewer> </Border> </Microsoft_Windows_Themes:SystemDropShadowChrome> </Popup>
Quand je lance l'application, il me trouve bien la ligne, on voit bien qu'il la trouvée, mais il ne la sélectionne pas
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 Localite selectedLoc; public Localite SelectedLoc { get { return selectedLoc; } set { selectedLoc = value; RaisePropertyChanged("SelectedLoc");; } }
Quand je sélectionne une autre ligne dans une autre datagrid qui déclenche la propriété SelectedLoc, la ligne est sélectionnée comme il faut ...
J4ai essayer la même datagrid en dehors d'un template, ca marche au poils.
Auriez-vous une idée?
Partager