2

我需要找出如何将字符串传递给a的 aComboBox内部。背后的想法是,每当我双击a出现并从中选择新内容时(在 a 内)。TemplateColumnDataGridTextBoxPopupTextBoxComboBoxPopup

XAML

<DataGridTemplateColumn Header="unit">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <TextBox Text="{Binding unit}" MouseDoubleClick="TextBox_MouseDoubleClick_1" />
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>

<!-- The columns in the grid are binded to DataTable-->

<!-- Popup -->
<Popup Name="unitpop" StaysOpen="True" VerticalOffset="-20" HorizontalOffset="30" Placement="Mouse" >
    <Grid Width="100" Height="20" Background="Transparent" >
        <ComboBox x:Name="unit_combo" ItemsSource="{Binding Source={StaticResource UnitListData}}"  DisplayMemberPath="Name" SelectedValuePath="idunit" IsReadOnly="True" SelectionChanged="unit_combo_SelectionChanged" />
    </Grid>
</Popup>

<!-- The ComboBox is binding an ObservableCollection -->
4

0 回答 0