tags:

views:

100

answers:

1

Hi WPF lovers, I want to display all the possible enum values as Radio buttons. I am using popular RadioButtonList style to display the radiobutton from my enum using DataProvider in a Listcontrol. I can get all the radio buttons but the text appear with the radio button is not user friendly. I am using the following method.

http://social.msdn.microsoft.com/forums/en-US/wpf/thread/5137aabc-bb3a-478a-9438-bc93dd9cc0ac/

I want to show "A ball" instead of "a" and "B ball" instead of "b"

I thought about using converter. But where to use convert. Or any other way to display user friendly values?

As this style is very common, thats why I am not writing whole code. If anything not clear, please ask. I have already invested about 5 hours on this problem.

A: 

Change the empty ContentPresenter to the following binding:

<ContentPresenter>
    <ContentPresenter.Content>
        <Binding Converter="{StaticResource EnumToUserFriendlyName}"/>
    </ContentPresenter.Content>
</ContentPresenter>

Then in the converter you can check the enumerated value and return a more user-friendly name.

Charlie
Thanks Charlie. U saved my time. Its working fine.
Saghar