xml 파일에 두 개의 목록 상자 컨트롤 (즉, xml에 바인딩 된 목록 상자와 첫 번째 목록 상자에 바인딩 된 다른 목록 상자)을 바인딩했습니다. 목록 상자는 바인딩 결과로 xml 파일 내의 노드 값을 표시합니다. 추가, 편집 및 삭제 작업을 수행하고 원본 파일을 유지할 수 있지만 창을 닫은 다음 다시 열지 않으면 대상이 업데이트되지 않습니다.바운드 대상이 업데이트되지 않음
<ListBox Name="listBox1" Width="224" Height="115" Margin="0,0,0,5"
IsSynchronizedWithCurrentItem="False" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Style="{StaticResource ListBoxStyle1}"
ItemsSource="{Binding Source={StaticResource RecipeList}, XPath=recipeType,
Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Background="Black">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="170"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Height="35" Background="#181818">
<TextBlock Background="Black" Margin="1" FontWeight="Bold"
Padding="7" Height="33" Width="184" Foreground="#D0D0D0">
<TextBlock.Text>
<MultiBinding StringFormat="{}{0}">
<Binding XPath="@description" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</StackPanel>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
을 두 번째 목록 상자를 위해 :
<ListBox Name="listBox2" Width="218" Height="144" Margin="0,0,0,5"
IsSynchronizedWithCurrentItem="True" Style="{StaticResource ListBoxStyle1}"
ItemsSource="{Binding ElementName=listBox1, Path=SelectedItem, Mode=OneWay}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Height="auto" Background="#181818">
<TextBlock Padding="7">
<StackPanel Background="Black" Margin="-5.5,-5.5,-6,-6.8">
<TextBlock Width="210" FontWeight="Bold" FontSize="12"
HorizontalAlignment="Left" Text="{Binding XPath=name}"
Background="Black" Foreground="#D0D0D0" Padding="0" Margin="5,0,0,3" />
<TextBlock Width="187" FontSize="11" HorizontalAlignment="Left"
Text="{Binding XPath=summary}" Background="Black" Foreground="Gray"
Margin="5,0,0,5" />
</StackPanel>
</TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
내 질문이 대상을 업데이트하거나 새로 고침 /이 경우 창을 다시로드하는 방법은 다음과 같이 첫 번째 목록 상자에 대한 코드입니다.
입력 해 주셔서 감사합니다.
타겟별로, _listBox2_를 의미합니까? – publicgk