I have the following setup:
This is the main screen:
<ListView Name="lineData" Grid.Row="2" ItemsSource="{Binding ElementName=This, Path=LineInformation, ValidatesOnDataErrors=True}"
ItemContainerStyle="{StaticResource ItemStyle}" PreviewMouseUp="lineData_PreviewMouseUp" SelectedIndex="0"
Foreground="{StaticResource {x:Static SystemColors.ControlTextBrushKey}}">
<ListView.View>
<GridView x:Name="gridViewItems" AllowsColumnReorder="false">
<GridViewColumn Header="Product" Width="Auto">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<ComboBox Name="descriptionComboBox" Loaded="description_Loaded"
DisplayMemberPath="Description" SelectedItem="{Binding Path=Product}" SourceUpdated="descriptionComboBox_SourceUpdated"
MinWidth="200" Width="Auto" SelectionChanged="description_SelectionChanged" TargetUpdated="descriptionComboBox_TargetUpdated">
<ComboBox.ItemsSource>
<Binding Source="{StaticResource XmlFile}" />
</ComboBox.ItemsSource>
</ComboBox>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
There is a button on this screen that brings up a new window as follows:
Window newWindow = new Window();
buildWindow.Owner = this;
buildWindow.ShowDialog();
This new window filters out the values that are in the combo box in the first window, for example:
XmlDataProvider provider = Owner.FindResource("XmlFile") as XmlDataProvider;
provider.XPath = _configuration.CreateFilterQuery();
provider.Refresh();
Thus, combobox has a binding to this XmlFile. The problem is that now I need to keep the value displayed in comboboxes if they are in the category of the new filter.
But when I call the .Refresh () function, the selected index with the list is reset.
Any ideas on how to save the displayed text after applying the XPath query?
Thanks Hi.
source
share