Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

user control was intilized when calling in second time,how to avoid it

$
0
0

HI

There is implementation which I cannot changed the framework and I need to create new user control
in wizard,currently the issue is that I done some mapping from list view to text boxes of the user control
which working fine, but when you click on back and than hit next a you see that the mapping from the list
view to the text boxes  was initialized.

I know that the problem is that we are calling to the user control again and in the InitializeComponent();
the user control was created from the beginning,but I cannot change it regrettably

In addition I have static object that store the viewModel and keep there the mapping.
my question is there is a way or some trick that  from this object which is storing key value (like text boxName and the field which is mapped to it from list view likefirstName)
to fill the screen again after the InitializeComponent();,or other trick your suggestion.

I have static instance That I update with the mapping so I able to know if the user control called for the second time....


in the user control I have all the functionality for D&D which I cannot change right now(too complicated 4 me)
in the view model I update during the first time  the following objects


        private Dictionary<string, string> _mapping = new Dictionary<string, string>();
        private ICollectionView _mappingCollectionView;
        private ObservableCollection<PropertiesMappingModel> _propertiesMappingList;




and for example I have field like


<TextBox x:Name="Name"  
                    AcceptsReturn="True"
                    AllowDrop="True" "
                    SelectionChanged="listbox_SelectionChanged"
                    HorizontalAlignment="Left" Height="25" TextWrapping="Wrap"
                    VerticalAlignment="Top" Width="150" Margin="99,33,0,0" Grid.Column="1" Grid.Row="1" />



Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>