Hi All,
This below code is my actual requirement.
public partial class MainWindow : Window
{
public List<KeyValuePair<int, double>> Collection { get; set; }
public MainWindow()
{
InitializeComponent();
Collection = new List<KeyValuePair<int, double>>();
Collection.Add(new KeyValuePair<int, double>(1, 18));
Collection.Add(new KeyValuePair<int, double>(2, 36));
Collection.Add(new KeyValuePair<int, double>(3, 24));
Collection.Add(new KeyValuePair<int, double>(4, 42));
Collection.Add(new KeyValuePair<int, double>(5, 30));
List<object> actualdata = new List<object>();
for (int c = 0; c < Collection.Count; c++)
{
actualdata.Add(Collection[c]);
}
bool flag = false;
Model modal = new Model();
modal.Item = actualdata[1];
object ob = actualdata[1];
if (modal.Item == ob)
flag = true;
else if (ob.Equals(ob))
flag = true;
else
flag = false;
}
}
public class Model : DependencyObject, INotifyPropertyChanged
{
public int xval { get; set; }
public object obj { get; set; }
public object Item
{
get { return (object) GetValue(ItemProperty); }
set { SetValue(ItemProperty, value); }
}
public static readonly DependencyProperty ItemProperty =
DependencyProperty.Register("Item", typeof(object), typeof(Model), new PropertyMetadata(null, OnPropertyChanged));
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as Model).onPropertyChanged("Item");
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void onPropertyChanged(string name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs("Item"));
}
}
}
When am trying to run the sample , the equal operator return true in WPF and return false in UWP. Can anyone please share you ideas?