How to make radiobuttonbar in wpf xaml with a nice look - c#

I want for my user that they can select one option from a ItemsControl
When i use radiobuttons it is not looking nice so i like to have something like picture 2
but then with a nice solution to see what option is selected.
I am new to wpf, can someone point me to the right direction with xaml

Hey use a ListView and Binding the SelectedIndex do an Integer so you know which one is selected. In this way you could set a picture or some style properties in dependency to the SelectedIndex.
If you really want your solution than change the Back- or Foreground Property with an OnMouseUp or with a Command. Hope this helps

Related

Get DataGridCell Row and Column of marked cells and Building a button over that

I have a program in MVVM. In this program i have a view with a DataGrid. In this datagrid i have to show something like this:
The user mark some cells and after MouseUp, should be created a button over this selected cells. The first Problem here is, how to get the Column and the Row. It is in the SelectedCellsChanged-Event Argument. With help from the WPF MVVM Light i can give my ViewModel the Event and the Arg, but my workmate had already problems with visual elements in a ViewModel(He was get a error in the visual tree). And i know that a visual element should not be in a VM. Can anyone here give me a way to get this Column and Row-Spawn?
My second problem that i can't imagine me how to create the buttons in the correct cell. If i think right is it possible to build a new VM for every Button(with Property StartRowSpawn, EndRowSpawn, StartColumnSpawn, EndColumnSpawn) or for each cell?
Can you give me tip, how to solve that?
I thinked about a grid too. Get position while MouseDown and MouseUp and then find the Grid.Column and Grid.Row for that.
Edit
Okay i done my first problem with Interfaces, but i already have my second problem. Can anyone help me there?
I would rethink why you need to do this(or maybe you can explain more why to need buttons like this). What I do when I need to change the design of data in a data grid is use an alternate datatemplate or the details datatemplate for the datagrid row to chnage the format of the infomration, then you can use the same view model. You can bind the column spans to properties in your viewmodel but it gets difficult if you want the button quantities to be dynamic.

Conversation-like view in ListBox or ListView

I am trying to get a conversation-like style going with either a ListBox or Listview but so far unsuccessfully. I don't even know where to start in order to achieve this.
I know how to style ListBox and ListView in other ways, but this particular style I have no idea where to start.
Can anyone please help point me in the right direction? Below is the kind of style I am trying to achieve:
Notice how in the image above, list items are left-aligned, but every other list item is right aligned (but the text inside the item is left-aligned), and every second list item also has a different background color.
I would consider using a DataTemplateSelector. Create a different template for each of the styles. The template selector could select one style if it's user A and another for user B or something along those lines.

ListView with TreeViewItems in xaml

I'm pretty new to c#, the first thing that I'm trying to make is a ListView with data bindings which has turned out ok.
I'm now trying to make items have a twist button if the underlying model has any children (like the TreeView). Each of the children will have columns the same as all the top level items.
How would I go about doing this? Is there an already existing control like this? If not would I be better off dressing up a TreeView to look like a ListView, or dress up a ListView to look like a TreeView?
I went down the road outlined in this solution which dresses up a TreeView, but the end result looks pretty awful and the heading is actually just an item, so you lose all the nice column sizing and column buttons that can hook up to column sorting that you get in ListView so that route actually seems like it would be more work.
I noticed the new task manager has a control exactly like what I'm trying to create, I don't know how this made? probably in C though.
Microsoft provides a sample that appears to be what you are looking for. A write-up of the example can be found here:
http://msdn.microsoft.com/en-us/library/vstudio/ms771523(v=vs.90).aspx
When you build and run the example you will end up with something resembling this:
There is a large amount of templating done in the example, so you will be able to make things look the way you want.
What you describe sounds a bit like a TreeListView, and if you google 'WPF TreeListView' you will see some solutions that might be good for you. I have used one from Telerik, but it might be overkill depending on how complicated your needs are.
If you only want one sub-level like the image you attached, you might want to just roll your own using a ListView with a complex DataTemplate for the first column which would show an expander button and a simple ListBox bound to the children items.
Similar to the answer here, except your cell would have a checkbox styled to look like the arrow, the text for the item, and a child ListBox. Then bind the visibility of the child ListBox to the state of the checkbox.

Checkbox to look like expander

I"m trying to make a checkbox / button type thing that looks exactly like the expander button. I've written my code for IsChecked, but was hoping not to use the checkbox. I'm not sure if this makes any sense... how to do that in xaml?
The best way to make a CheckBox look like an Expander is to modify the ControlTemplate of the CheckBox (I assume you're already trying this).
Therefore I would have a look at the ControlTemplate of the Expander and try to modify it to use the data of the CheckBox class (or maybe an approach in the over direction would be easier, you will have to find out).
To see, how the ControlTemplate of the Expander is defined you can use Expression Blend to extract the template or have a look at this MSDN page.

change listviewitem tooltip to balloon

is there a simple way to set the tooltip property of a listview item to be a balloon? Typically all i would do is:
Tooltip tt = new Tooltip("This is a tooltip");
tt.isBalloon = true;
but how do i do this for a listview item
You can manually show ToolTip when mouse is over certain item
check this article
There isn't an easy way to change the tooltip on a ListView. See this blog for a detailed explanation of why.
ObjectListView -- an open source wrapper around a standard WinForms ListView -- does a reasonable amount of work for you so that you can show enhanced tool tips with minimal effort on your part.
Even if you don't want to use ObjectListView, you can still look at the code to see how it is done (admittedly, in the case of tool tips, there was a lot of work done and it would be tricky to extract that work into another project)

Categories

Resources