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.
Related
I'm using Catel in my application and I have problem with changing screens.
I have a ribbon navigation and a ContentPresenter for a screen. When I click ribbon button, I change ActiveView property in my ViewModel
It looks like this:
<ContentPresenter Margin="5 5 5 0" Content="{Binding ActiveView, Converter={StaticResource ViewModelToViewConverter}}" />
ActiveView is a ViewModel of my UserControl for specific view.
The problem is, that everytime I change screen (click ribbon button), I have a lag ~100ms which is very irritating.
I have also tried with DataTemplates for ContentPresenter, but there is no Performance boost with it.
Is there a way of boot performance of this? Maybe a way to pre-construct view, and then only show it? (because right now View is being constructed everytime I click a ribbon button)
Of course I'm checking it on Release build (on debug there is much more lag) :)
Please check the performance considerations in the docs. A few hints:
Have you tried without a debugger attached?
Are there log listeners doing a lot of work?
Enable Api cop to see what features you are not using but are taking time. Then you can disable them.
Probably it's the control looking for the InfoBarMessageControl (which you can simply disable).
I'm facing a problem in implementing the following scenario:
When the user selects a record in a XamDataGrid, the control flows into another tab showing the details of the selected record.
The way I have done this is:
At the selection change of the XamDataGrid, I'm sending index of the tab to be activated using MVVM Light Messenger.
Setting the property bound to the Seledted Index of the Tab Control to that number.
Everything works smooth till here. Afetr that if I go back to the tab containing the grid, somehow the control comes back to tab which was activated.
As if, some intrinsic selection of cells in happening in the grid. Does Hover also affects the selection of the xamdatagrid?
I'm new to Infragistics and kind of confused. If some one can help.
All code are in View Model files and no code in the code behind of xaml file.
Cheers,
Anshuman
I played around a lot.
But the only way to get this wqorking was to disable all hover animations and effects.
Now it works as expected!
I'm getting there with this WPF validation, IDataErrorInfo, INotifyPropertyChange stuff, but new issue on refresh. I have a window with a bunch of controls on it. I have a tabbed page interface and for simplicity have 2 pages... 5 controls on each.
I start to "Add" a record, so all fields are blank. Ex: 3 of the fields on the first page that require validation are properly flagged as red border to indicate they are required... no problem.
Now, I click on to page 2 and immediately back to page 1. The red borders are all gone. They don't reappear red unless I explicitly tab through them to re-focus them, lose focus and force it to do its lostfocus / property changed validation via IDataErrorInfo.
First, any explanation WHY WPF is losing what the first page looks like just because it has to change page 1's visiblity to show page 2, and then back to page 1.
Second, suggestions on how to force the controls to be properly refreshed with the red border indicating they are required.
Thanks
Just put the controls you validate inside an AdornerDecorator an it will work fine ;)
<TabItem>
<AdornerDecorator>
<Grid>
<TextBox>
</TextBox>
...
</Grid>
</AdornerDecorator>
</TabItem>
If I recall correctly, the default error validation markers for controls are just red boxes overlaid over the top of the control, not part of the control itself, so the visibility of that overlay does not persist if the control is hidden. You might try changing the control template to incorporate a red border / label directly as part of the control, and that issue might be cleared up.
To force all your bindings to refresh (and therefore their validation) all you need to do is call RaisePropertyChanged again for any property you want to re-validate. It's a little wasteful, but you can just call RaisePropertyChanged with an empty string as parameter, and it will raise for all properties in the viewmodel.
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.
i am trying to create a wpf app and have different parts in user controls.
in the navigation i have some buttons (now using the ribbon ctp). is it possible to change the main user control when different buttons are pressed in xaml. or is this just a bad way to do things?
sorry, really new to xaml and im trying to get my head arround it.
Further to what Carlo has said,
The way we do it is to have a blank grid in the place you want your controls to all appear and then use BlankGrid.Children.Clear() and BlankGrid.Children.Add() to set up which control is visible in this position.
We found that was the nicest programatically as we have a large number of custom controls, but Carlo's method would work nicely if you wanted to use the designer.
I think this is a pretty regular procedure in WPF. In my experience, me and other programmers put the controls where we want to show them and make their visibility hidden, collapsed or visible depending on what we want to show the user.