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.
Related
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
I try to create a custom EditingControl for a ListBox in c#.
I am only want to change the square into a simple stripe. I make a lot of research but I don't find any solution. All stuff I found was about custom ListBoxes itself but not the EditingControl.
So, is there a way to capture the Paint-Event while entering the Control, or Overwriting some base-Class?
It should look something like this but you see, the default EditingControl make it a lil complex.
Greetings, Martin.
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.
I'm checking this page and I like the only answer there is.
Editable WPF treeview item on doubleclick? (with styles?)
But I don't like the idea to use c# lines, Might there be a possible to write that code using XAML?
You can use EventSetter, or AttachedBehavior. But they are assumes that you need c# code-behind.
How to do it in XAML - hard to say. One more possible way - to use x:Code clause to write c# code inside xaml.
You can use CheckBox in the XAML and using its IsChecked property change the Style to the Editable mode
Visual Studio QuickWatch window has a hierarchical property grid control. Is a control like that available somewhere?
The default property grid control doesn't seem to work for me as it requires the objects to have an ExpandableConverter attribute to work the way I want. Although, if any of you know a way to turn the property grid into a QuickWatch-like control it would also be accepted.
Thanks.
It is very spread type of control. Each Library-of-Controls company created at least one.
http://images.google.com.ua/images?q=tree%20like%20grid
Here you have two samples:
http://www.codeproject.com/KB/grid/PropertyGridExWinForms.aspx
http://www.howtocode.net/software-development/c/propertygrid-utilities
I don't think so, its something you would have to create your self.
looks like it wouldn't be to difficult, I think its DataGridView where the first column is a custom cell that when clicked does a hit test to see if its hit a node glyph.
But i could be wrong.