How to refresh list box using MVVM?

Asked By 0 points N/A Posted on -
qa-featured

I’m using Project A to transfer the information from Project B. The “XAML” of Project B can be viewed through Project A.

Then, I made some updates on Project B.

I want to refresh the list box on the Project A using MVVM.

Can anyone help me on how to do that?

SHARE
Answered By 0 points N/A #105962

How to refresh list box using MVVM?

qa-featured

Hi,

There are two different ways to refresh the list box using MVVM.

The program code will be like this

Dynamically refresh:

:BoxItemContainerStyle="{DynamicResource ListBoxItemStyle1}"

ItemsSource="{Binding Authors, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"

DisplayMemberPath="Fullname"Name="AuthorsListBox"sSynchronizedWithCurrentItem="True"/>

Manually refresh:

<ListBoxx:Name="lstFruitBasketLeft"ItemsSource="{Binding FruitBasket}"

     SelectedItem="{Binding SelectedFruit, Mode=TwoWay}" Width="150">

<ListBox.ItemTemplate>

    <DataTemplate>

        <StackPanelOrientation="Horizontal"VerticalAlignment="Center"

                    HorizontalAlignment="Left"Margin="2">

            <TextBlockText="{Binding Name}"/>

            <TextBlockText=":"/>

            <TextBlockText="{Binding Quantity}"/>

        </StackPanel>

    </DataTemplate>

</ListBox.ItemTemplate>

These are just example. Might be little different from your program code.

You need to re organize it as your own method.

But the main themes of refresh the list box using MVVM will be remain same.

So I think this will be helpful to you.

Login/Register to Answer

Related Questions