Ok I got it fixed thanks to you. here is what I found
I implemented the INotifyPropertyChanged
working perfect now.
sweet
Ok I got it fixed thanks to you. here is what I found
I implemented the INotifyPropertyChanged
working perfect now.
sweet
here is the class with the changes
public class Viapoints : INotifyPropertyChanged
{
private string _simpleAddress;
private string civicNumber;
private string civicName;
private string civicCity;
private string civicPostalCode;
private string civicProvince;
private string viaType;
public Viapoints()
{
}
public Viapoints(string simpleAddress, string viatype)
{
this._simpleAddress = simpleAddress;
this.ViaType = viatype;
}
public Viapoints(string cnumber, string cname, string ccity,string cpostalcode, string cprovince)
{
this.civicNumber = cnumber;
this.civicName = cname;
this.civicCity = ccity;
this.civicPostalCode = cpostalcode;
this.civicProvince = cprovince;
}
public string SimpleAddress
{
get { return _simpleAddress; }
set { _simpleAddress = value;
NotifyPropertyChanged();
}
}
public string ViaType
{
get { return viaType; }
set { viaType = value; }
}
public string CivicNumber
{
get { return civicNumber; }
set { civicNumber = value; }
}
public string CivicName
{
get { return civicName; }
set { civicName = value; }
}
public string CivicCity
{
get { return civicCity; }
set { civicCity = value; }
}
public string CivicPostalCode
{
get { return civicPostalCode; }
set { civicPostalCode = value; }
}
public string CivicProvince
{
get { return civicProvince; }
set { civicProvince = value; }
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
I of course changed the code because I want to experiment and learn, I get this problem that the WaypointList listview doesn't update when I try to edit one of the items. the adding and deleting part works perfectly.
basically what I did is create a class that will hold the data and then add waypoints using the class.
here is the code for only the edit part and the XAML. if needed other parts please let me know.
Thank you
XAML
--------------
<ListView x:Name="WaypointList" ManipulationDelta="ListViewManipulationDelta" Background="#33309501" BorderBrush="#FF309501"
BorderThickness="2" ManipulationMode="All" Visibility="Collapsed" Header="Route addresses" HorizontalAlignment="Right"
VerticalAlignment="Center">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Width="Auto">
<TextBlock Text="{Binding Path=ViaType}" FontWeight="Bold" Margin="10,0,0,0" FontSize="18" Foreground="Black" />
<TextBlock Text="{Binding Path=SimpleAddress}" Margin="20,0,0,0" FontWeight="Bold" FontSize="18" Foreground="Black" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.RenderTransform>
<TranslateTransform />
</ListView.RenderTransform>
</ListView>
here is the edit part
-------------------------
private void Edit_Click(object sender, RoutedEventArgs e)
{
var selectedIndex = WaypointList.SelectedIndex;
NewItem.Text = WayPoints[selectedIndex].SimpleAddress;
DialogButton.Content = "Change";
EntryDialog.IsOpen = true;
NewItem.Focus(FocusState.Programmatic);
}
here is how I instantiate the class
ObservableCollection<Viapoints> WayPoints;
public MainPage()
{
this.InitializeComponent();
WayPoints = new ObservableCollection<Viapoints>();
WaypointList.ItemsSource = WayPoints;
}
the edit is actually happening in the class but not in the listview
I hope it has some sense.
thank you
Hi,
I have two XML documents, identical in structure. If a element value in A is different than B, then it needs to be copied to B (or a copy of B).
The solution can be using either xmlDocument or XDocument, I'm not particular as long as it works. I'm using **framework 4.0**, so I guess XDocument is the more modern approach.
So it seems logical to me that I would traverse every node/element of document A, and then query the same in B and compare values, and if different, then the A element value gets copied to the same element in B (or a copy of B).
I'm a total newbie with querying XML documents in **C#**, so I thought I'd ask here to save time.
Thanks,
Barry
Barry O'Neill
Hi,
You can use the SelectNodes method of XMLDocument to select the particular node then you can modify the value for that.
Please check the below URL
Best Regards
Barry O'Neill