This is a migrated thread and some comments may be shown as answers.

IsChecked is not working

6 Answers 99 Views
Menu
This is a migrated thread and some comments may be shown as answers.
naveen
Top achievements
Rank 1
naveen asked on 17 Jun 2009, 03:42 PM

Silverlight Version installed  - Silverlight 3.0 Beta.

Hi,
I want to make context menu mutually exclusive checkable, however if i checked one item other item is not becoming unchekced. I am using following function to unchecked other items

 

 

private void UnCheckedOtherItems(RadMenuItem selectedItem)

 

{

 

for (var i = 0; i < itemMenu.Items.Count; i++)

 

{

 

var container = itemMenu.ItemContainerGenerator.ContainerFromIndex(i) ?? itemMenu.Items[i];

 

 

var separator = container as RadSeparator;

 

 

if (separator != null)

 

{

 

continue;

 

}

 

var subItem = container as RadMenuItem;

 

 

if (subItem != null && subItem.Equals(selectedItem))

 

{

subItem.IsChecked =

false;

 

}

}

}

Your help will be highly appreciated.

Regards
ncv

6 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 18 Jun 2009, 11:38 AM
Hello ncv,

I prepared a simple example demonstrating the best way to create "radio-button" menu items. It uses a ViewModel that contains the logic for the radio buttons and the groups, and a RadMenu that is data-bound to that model. The application is Silverlight 2, but the code should be exactly the same in Silverlight 3, so I hope you will not have problems using it.

All the best,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
naveen
Top achievements
Rank 1
answered on 18 Jun 2009, 03:15 PM
Thanks Valeri,

Samples is running fine for both Checkbox and Radio Button Options, however I have seen some issue with Radio buttons items which was my exact requirement. E.g. Suppose I click  at Radio Button 1.1. and after that I click at Radio Button 1.2, First clicked item is not showing unchecked i.e. still checked. It refresh when I focus in Radio Button 1.1.

Can you please suggest me the way to resolve it.

Regards
NCV
0
Valeri Hristov
Telerik team
answered on 18 Jun 2009, 04:06 PM
Hello NCV,

If I understand correctly, the behavior you are observing could be related to a bug in Silverlight 3 Beta. Unfortunately I only have a virtual machine with an unofficial build of Silverlight 3 from Microsoft and it will take some time to prepare a VM with the public beta to check if it has the same problem. I shot a short movie on my existing VM, please let me know if I am missing something.

Regards,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
naveen
Top achievements
Rank 1
answered on 19 Jun 2009, 05:58 AM
Yes Valeri,

You are right, it could be bug in silverlight 3. Right now I m using Version 3.0.40307.0.

In your demo the working of radio button is woriking perfectly, however in my case it is not.

Now what you suggest?

Regards
NCV
0
Valeri Hristov
Telerik team
answered on 19 Jun 2009, 08:43 AM
Hi NCV,

I will check what's wrong with the menu and if it can be fixed, I will include the fix in the internal build next week. However, I would recommend waiting for the official release of Silverlight 3 that is scheduled for July 10:
http://blogs.zdnet.com/microsoft/?p=2912

Best wishes,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
naveen
Top achievements
Rank 1
answered on 19 Jun 2009, 09:45 AM

Thanks Valeri,

 

Nice to hear from your about Silverlight 3.0 Release.

 

Regards

NCV

 

 

Tags
Menu
Asked by
naveen
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
naveen
Top achievements
Rank 1
Share this question
or