I have the main.xaml where I have a ribbon with some tabs on it. Basically I have an Articles Tab, Categories Tab, Keywords Tab etc. What I would like to be able to do is, once I click on the Articles tab, I load the datagrid with the Articles, once I click on the Categories Tab, I load the datagrid with the Categories, and the Keywords the same thing. I was thinking of creating 3 datagrids, and once a tab is clicked I hide/remove the other 2. Is this the correct way to do it, and if it is how can I achieve this?
Thanks for your help and time
ok solved
I only needed this
dgCategories.Visibility = Visibility.Collapsed;
I haven't used a ribbon, but in a normal tab control you can set the SelectedContentTemplateSelector property to a DataTemplateSelector. This will provide a given template to the content that you have currently selected. This means that you don't have to worry about adding / removing controls as this will be handled by WPF.
In general when you are faced with changing display of content then I would recommend using a template selector.
Related
I'm using AvalonDock 2.0 as a tab control manager, however i have not come across a way to allow multiple lines of tabs (when needed), or a way to show that there are hidden tabs in the background.
Can the multiple lines of tab be accomplished through a template or style? or am i missing out on some basic properties that i didn't know?
The answer can be found at the Xceed forum here: https://xceed.com/forums/topic/display-multiple-lines-of-tabs-in-avalondock-dockmanager/
The idea is to override the template of LayoutDocumentPaneControl and provide an alternative implementation, then assign this new template to the DockingManager via its DocumentPaneControlStyle property.
I am trying to work though the best approach to accomplish the following. Within a page I have it divided into two section. On the left a listbox and the right is empty. (Grid etc). What I would like to accomplish is when an item is selected from the listbox a different user control loads in the right panel. For example if I have three items (one, two three) selecting one would load a red user control, two would load a blue user control and three a green user control.
I was taking this approach since Content Template / Data template selectors are not available in SL. However if anyone has another suggestion I would be grateful for your thoughts.
I'm creating this with MVVM in mind and traditionally I have managed this within the code behind of the user control however I have seen mention of how this could be managed within the ViewModel as well.
Any suggestions or guidance on a best approach is always appreciated.
Cheers
You can bind both listbox selected item and user control visibility properties to the same property in the viewModel.
Then just use a valueConverter for each user control to switch on/off the visibility.
Please tell me if i should elaborate/add a code sample.
I have a ListBox which contain text and image. When the user click on an Item I want that it will expand to the side and will show some more information.
I have tried to do it with Expander control, but it's does'nt expand over the ListBox border.
Does anyone have any suggestions ?
This sounds like a classic master/detail type of user interface - the ListBox is the master, and you want some detail to show once the user selects an item.
If the tooltip suggestion from Notter is not suitable, then i would suggest that you have your expander control beside the ListBox, not inside of it. There are already a multitude of posts here on SO deailing with this (usually using the DataGrid as the master, but the concept is the same), check out this search and see if anything is helpful.
You can maybe use a Popup/tooltip control (forgot it's name)
other than that, i can't think of anything that will do what you're asking, but i'm pretty sure anything you'll do won't have anything to do with the ListBox itself, but with the DataTemplate
I'm using "Microsoft Ribbon for WPF" and creating multiple RibbonTab. I cannot figure out a way to view/focus different tabs in the designer and it by default show the "Home" tab. To see design/xaml changes I made to tabs other than the "Home" tab, I have to debug the project every time and click through the tabs, which is not very convenient. Or I can command out the tab xaml I want to to ignore. Anyone body out there has a solution?
You can also use the SelectedIndex property on the Ribbon to set which tab is the currently selected tab (0 being the first tab, 1 being the second, etc.)
<ribbon:Ribbon SelectedIndex="0" />
The only way I have found is to set the Selector.IsSelected property to true. This will cause the tab to become visible at design time.
<ribbon:RibbonTab Selector.IsSelected="True" ...
I can't confirm this is working right now because my preview in general is not working properly, but this works in general in WPF when trying to hide something at design time only.
Include the namespace for blend
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Then in the element you want to hide use d:IsHidden="True". This will only affect design time, which eliminates the problem of forgetting to change the selected index to the correct value before building.
I want to create a combobox with some style. I dont want old dropdown what we are getting. I want some new dropdown which looks very nice. Is there any way to create a dropdown like that.
Plz give me suggestions
Check this link out on msdn. This is the actual control template for the combo box. You can copy and paste this into your application (within your app's Resources).
Create a form and slap a combo box on it with some data in it. Then start changing the control template and view the results. Start off simply by changing colors and adding borders around elements to see what controls which part. Then you can start switching out larger parts of the template to match what you're looking for.
one can start with the standard combobox, and then use various controls and styles to change the look and feel of the control, and it's corresponding drop down.