I'm trying to use TabControl template from MSDN.
http://msdn.microsoft.com/en-us/library/ms754137.aspx
Everything works fine until TabStripPlacement comes into the game.
Setting TabStripPlacement to “Left” doesn’t work. I’m getting this result.
While I need this template works with horizontal and vertical tab placement.
I’m not so familiar with styling and templates please help me to resolve this.
EDIT:
I expect this result when TabStripPlacement is set to “Top”
And this when TabStripPlacement is set to “Left”
Just like a normal TabControl
That TabControl template you lniked is an example, not the default.
You need to expand the Grid in the template to be 2x2 instead of 1x2, then create a series of Triggers that set the Grid.Row and Grid.Column of the TabPanel named HeaderPanel, and the Border object containing the content based on the TabStripPlacement
You can look at the actual default TabControl.Template by extracting the template using Expression Blend, or using the tool like Show Me The Template. It contains the triggers you'll want.
Related
I'm following this reference to implement an autocomplete textbox in my application:
http://www.broculos.net/2014/04/wpf-autocompletebox-autocomplete-text.html
I notice there is a difference when using an itemtemplate vs not using one. When using a template the items have more space between them. I need to use the itemtemplate but how can I make it look more like when not using a template, move the items closer to each other?
When not using an ItemTemplate, the single items in the dropdown list will be simple strings and will be represented by TextBlocks in the UI. TextBlocks don't have any margin by default, so the lines are close together.
Assigning an ItemTemplate will replace this visual appearance (with whatever the ItemTemplate defines). Most probably there is some margin/padding defined in the ItemTemplate, e.g. if an Label is used as representation (Labels have some default margin assigned).
Changing the margin/padding properties of the single elements of your ItemTemplate should help here.
The default template for TabItem, as defined here, assumes that the tab strip is at the top. If we change the TabStrip.TabStripPlacement to the right, left or bottom, the margins and border thicknesses don't make sense. How would someone go about changing these values based on the parent TabControl TabStripPlacement. This is for a style used in application resources not just for a specific instance of the control.
To answer my own question. I found out that there is actually a TabItem.TabStripPlacement that can be used on the control template triggers
I want to change the display behavior of the selected item(s) in a WPF Listview. Specifically, I want to retain the custom textblock foreground colors that I've applied and apply a border around the item.
I am able to alter SystemColors.HighlightBrushKey and ControlBrushKey to change the background color of the selected item, but I don't know how to get it to stop changing the font color or use a border instead. I've tried manipulating the control template and have also searched Google for examples of how to do this, without success.
yeah, looks like you have to go through the pain of using ControlTemplates.
Good news is that via using Expression Blend, you can get current ControlTemplate for ListView and tweak the bit that you need and use that as your default ControlTemplate.
Can the width of the dropdown be set to a different value than the AutoCompleteBox itself?
The Popup is a separate Part of the AutoCompleteBox, so it should be possible to extend that beyond the width of the text box.
In Blend, right-click on the AutoCompleteBox and select Edit Template > Edit a Copy, giving the new template a name.
Drill-down in the Objects and Timeline window to the 'Popup' part, and beneath that is a Grid. Change the width of that Grid to change the width of the popup content whilst maintaining the current width of the text box).
(I must admit I've only had chance to do this in Silverlight Spy, but it definitely works there so I can't see it being a problem doing it through Blend).
If you are not using Blend, just copy Default Style and Template of AutocompleteBox from MSDN and paste it into your App.xaml file (here is little tutorial on how to handle styles in app.xaml).
You can then modify that pasted style or template.
I have to change Listbox's control templated in a way that it can look like below image
alt text http://www.freeimagehosting.net/uploads/05598e4d35.png
i have added togglebutton in listboxdatatemplate...
have one stackpanel in listbox style template...
so structure is like
border - stackpanel - grid - itemcontainer[boder-togglerbutton]
now to make first and last item curved... what are the ways...
if i make stackpanel border curved... when firstitem is selected and its background is changed... it shows a square inside outer border... so i am not able to get look showed below...
any idea?? how to get design done in the way with listbox tht can be showed like image above...
in image 1,3 and 4 items are selected and others are in normal mode...
-thanks in advance
I did it with a listbox in Blend inside of the ItemTemplate by creating a leftBorder and a right Border that are in the same space. The leftBorder is defined with cornerRadius 10,0,0,10 and the right with cornerRadius 0,10,10,0. I then set them both to opacity 0 (you can use visibility if you prefer) and set a ChangePropertyAction on both of thier loaded events conditional on the first and last item in your list.
That is the bad part, I did need to do it conditional on the items in your list but you could define another property and set that to first and last or create multiple templates that you set if there are no more items in the list from the control (not in the template).
If you think this may be interesting to you, let me know and I will post on my blog as well as try to make a couple of adjustments for your situation. I am not sure how to upload a project to here.