Hi,
Firstly I must point out that this is to do with vs2010 and 2012 rather than a telerik product.
I have the following code:
When I execute the following line of code for a second time in VS2012 I get a return value of -1, where as in VS2010 in works fine every time.
When I say a second time, I mean that I execute the "click" function once and all works well, but when the click executes a second time, then I keep on getting a return value of -1. As I previously mentioned, this problem does not exist when using VS2010.
Does anyone have any ideas of why this may be?
Thank you very much for your time taken to read this and I look forward to any responses that you may have.
Rob
Firstly I must point out that this is to do with vs2010 and 2012 rather than a telerik product.
I have the following code:
private
void
treeMenuItemEditProduct_Click(
object
sender, RadRoutedEventArgs e)
{
if
(
this
.treeProducts.SelectedItem !=
null
)
{
RadTreeViewItem treeViewItem = (RadTreeViewItem)treeProducts.SelectedItem;
Products selectedProduct = treeViewItem.Tag
as
Products;
EditProductsWindow editProductWindow =
new
EditProductsWindow(selectedProduct);
editProductWindow.Owner = Window.GetWindow(
this
);
editProductWindow.IsRestricted =
true
;
editProductWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
editProductWindow.ShowDialog();
//Check if the closing window achieved or failed its task
if
(editProductWindow.DialogResult ==
true
)
{
//Get collection Index of selected product
int
index = TAS2Database.DBTimers.GetProducts.EnabledProducts.IndexOf(selectedProduct);
//Remove Selected Product from List
TAS2Database.DBTimers.GetProducts.EnabledProducts.Remove(selectedProduct);
//Add new Product to Products List
TAS2Database.DBTimers.GetProducts.EnabledProducts.Insert(index, editProductWindow.newProduct);
//Amend TreeViewItem
treeViewItem.Tag = editProductWindow.newProduct;
treeViewItem.Header = editProductWindow.newProduct.Name.ToString();
treeViewItem.ToolTip = editProductWindow.newProduct.ID.ToString();
}
}
else
{
RadWindow.Alert(
"Please select a product to edit."
);
}
}
When I execute the following line of code for a second time in VS2012 I get a return value of -1, where as in VS2010 in works fine every time.
//Get collection Index of selected product
int
index = TAS2Database.DBTimers.GetProducts.EnabledProducts.IndexOf(selectedProduct);
When I say a second time, I mean that I execute the "click" function once and all works well, but when the click executes a second time, then I keep on getting a return value of -1. As I previously mentioned, this problem does not exist when using VS2010.
Does anyone have any ideas of why this may be?
Thank you very much for your time taken to read this and I look forward to any responses that you may have.
Rob