WPF> Using RadioButtonList style. I want to display user friendly enum strings. how?

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.

-------------Problems Reply------------

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.

Category:wpf Views:0 Time:2010-04-21
Tags: wpf

Related post

  • WPF: Change the style of a ViewBox depending upon the amount of data 2010-05-03

    I have a WPF app that has a ViewBox to display the items in my collection, diplaying a 2-column grid for my results. What I'd like to do is, depending on the number of items in my collection, change the number of columns. E.g if there are < 10 ite

  • Style unordered list to display list items in rounded corner box 2009-07-10

    I would like to style a <ul> to display all items in a box with rounded corners (see below): Is it possible to use CSS and only the <ul> (with no additional <div>s and tables), as I'm going to use it in a CMS system to style all

  • Calculate the display width of a string in C#? 2008-11-04

    A Java version of this question was just answered, and, well, I don't know how to do this in .net. So how do you calculate the display width of a string in C# / .net? --------------Solutions------------- You've got the same problem in this question a

  • How can I display an array of Strings in a Spinner with Spinner.setAdapter? 2010-06-09

    I have an xml layout file which contains a few widgets including a Spinner I want to display a list of strings in the spinner, the list is generated at runtime as a result of a function so it can not be in arrays.xml. I tried doing: String[] SpinnerI

  • How to get displayed width of a string? 2011-07-20

    When you have non-fixed width characters (such as \t) in a string , or escape codes, such as those for ANSI color (such as \1xb[31m), these characters add to the .length() of an std::string, but do not add to the displayed length when printed. Is the

  • Symfony2 display integer column as string 2012-03-13

    I'm working on a Symfony2 application, that I use to manage my monthly budget. I have an entity Expense, with an amount column that is saved as a float in the db /** * @ORM\Table(name="expenses") * @ORM\Entity */ class Expense { /** * @ORM\Column(nam

  • Trying to display a random generated string on my page 2014-04-29

    I'm trying to display a random generated string on my page (php), but I have absolutely no idea how to do this. I only want the following letters and digits to be used: B C D F G H J K M P Q R T V W X Y Z 2 3 4 6 7 8 9 In the following format: XXXXX-

  • Outlook 2010 Chinese characters for SENDER and SUBJECT are displayed either in a string of question marks or incomprehensible. 2014-07-12

    Hi I am using Outlook 2010. When my email comes in with Chinese character in Sender and SUBJECT, the Chinese Character are displayed either in a string of question marks or incomprehensive. When I log into my POP account via webmail the Chinese chara

  • WPF button textwrap style 2009-04-15

    How do I change the default textwrapping style of a button in WPF? The obvious solution of: <Style x:Key="MyButtonStyle" TargetType="{x:Type Button}"> <Setter Property="TextWrapping" Value="Wrap"></Setter> </Style> doesn't wor

  • issue with wpf datagrid cell style when scrolling 2010-06-04

    I created a new DataGridCell style for my wpf datagrid (Red Border brush). When I scroll down vertically the selected cells disappear which is ok. When I scroll up I see the selected cells but few of them missing their style and it appear in wrong ce

  • WPF - How to style the menu control to remove the left margin? 2010-06-05

    I have added a default menu control to my user control. I need to style the menu to remove the left margin containing the space for the icon or checkbox. How can I do this? XAML: <Menu> <MenuItem Header="MyMenu" FontSize="10"> <MenuIte

  • Is there something in WPF similar to Style.BasedOn for DataTemplate? 2010-12-04

    At the moment, I have two very large DataTemplate objects to display two sets of items in two ListBoxes. The DataTemplates are referenced in the ContentTemplate property in two Styles that are set in the ItemContainerStyle properties of the two ListB

  • WPF: How to style or disable the default ContextMenu of a TextBox 2008-08-13

    Apparantly when users right-click in our WPF application, and they use the Windows Classic theme, the default ContextMenu of the TextBox (which contains Copy, Cut and Paste) has a black background. I know this works well: <Page xmlns="http://schem

  • WPF iGoogle dock style library 2009-05-05

    I'm looking for a docking library or resources that discuss building an iGoogle style dock layout. I've played with a few third party controls today that were mentioned in this post(http://stackoverflow.com/questions/344205/recommendations-on-a-wpf-d

  • Composite WPF Visual Studio Style Interface 2009-05-14

    I am looking to design an interface in the style of the Visual Studio interface with WPF Composite Application Guidance (PRISM). I would like to have a tree on the left with the different views that can be opened. When some one clicks on a node in th

  • WPF custom control style problem 2009-07-13

    I have a custom control (from MS Toolkit - DatePicker). I've made my own style like this: <Style TargetType="{x:Type local:DatePicker}"> But this style does not apply automatically. I have to add Key: <Style x:Key="DatePickerStyle" TargetTyp

  • C#/WPF: Add Window.Style, even if a ResourceDictionary already exists 2009-07-16

    I'm trying to add two Datatriggers to my WPF Window. Normally, this would work via adding `<Style TargetType="{x:Type TextBlock}"></Style>` to the Window.Resources. In this case, I already have `<ResourceDictionary Source="/Presentatio

  • WPF DataGridCheckBoxColumn custom style? 2009-08-28

    Is there any way to style the checkbox in there? iv tried to define a style for the checkbox but that didn't work. after using mole it seems like the checkbox control does not have a ToggleButton in it it uses a BulleDecorator instead, im not sure of

  • WPF Databinding and Styles with MVVM 2009-09-28

    I have a problem with databinding on a style in WPF. The basic setup looks like this: <Style x:Key="{x:Type eo:Player}" TargetType="{x:Type eo:Player}"> <Style.Triggers> <DataTrigger Binding="{Binding Team}" Value="A"> <Setter Pr

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.152 (s). 11 q(s)