We have a Silverlight application with a RadRibbonBar at the top. The user can collapse it (not Visibility.Collapse) to just the menus with a double-click.
The IsCollapsed property is ReadOnly, but we need to retain the user preferences across runs of the app.
How do you programmatically set the IsCollapsed state of a RadRibbonBar?
Result
Silly me (and shows that the documentation is a little hard to find/follow). I had to google "RadRibbonBar IsMinimised" to find the actual page: http://www.telerik.com/help/silverlight/telerik.windows.controls.ribbonbar-telerik.windows.controls.radribbonbar-isminimized.html
Thanks to Stephen McDaniel for pointing out my error.
I think you might be confusing "Collapsing" a RibbonBar with the idea of "Minimizing" it.
Collapsing is something the RibbonBar does automatically when the window gets very small - which is why it's ready-only. From the documentation:
RadRibbonBar supports collapsing, which means that the ribbon may
automatically collapse to save space when the application is resized
to a smaller size.
But what you are describing (double clicking to get just the menu) is called Minimizing. From the documentation:
RadRibbonBar supports minimization, which means that the ribbon may be
hidden so that only its tab headers remain visible. In this state,
more screen real estate is available to the client area of the window.
And luckily, controlling Minimization via code is very easy. You can use the IsMinimized property:
IsMinimized - use this property to set or get the current minimize
state of the ribbon.
So you should be using the IsMinimized property instead of IsCollapsed.
You can check out the documentation links I provided above for more information.
Related
I'm working on a project that involves creating a custom graphical editor. The graphical editor has multiple tabs, and I want to create a preview function that will show a popup with Bitmap previews of the content of each of the tabs. However, the problem I'm running into is that the content for each of the tabs must be arranged before a proper preview can be generated for it. This means going into each of the tabs to ensure that they're rendered and arranged. Then, and only then, do the previews get properly generated, otherwise the previews have a size of 0x0. Does anybody know how to force an arrange of a content control so that I can get a properly sized preview generated ?
Apparently you can just call the 'Arrange' method directly, but you have to be careful about the rectangle you pass in as a parameter, because it can adversely affect the display of your control if you just want to force the object to draw itself (ie can force it to draw out of the desired position).
Here is a link to MSDN where it discusses the "arrangeOverride" method of a control.
I'm not sure this is what you need, but this method seems to be what you're asking about.
Hope this helps!
I have several Wpf pages in my project, these pages have different forms and ui control indide theme. The image below shows the mainWindow and there are two button.
I want to show a specific page when I click on + or Edit button using the Frame control which is highlighted.
apparenatly this woks:
Page1 me = new Page1();
mainFrame.Content = me;
But it has an IE navigation sound and a toolbar appears after going to page2.
any better way to show diffrent pages and not using a frame?
You may want to convert the Page into a UserControl. You can then put that control inside some other container, such as a Grid. You'll have to manually swap out the pages in the container when navigating, but it looks like you're doing that anyway.
The purpose of the Frame control is to allow navigation. If you don't want navigation, then don't use Frame. You can turn off the navigation toolbar, but that won't actually disable navigation - there are mouse buttons and keyboard shortcuts for navigating back.
If you just want to host a UI element without navigation, use something simpler, like a Border element - put the content in its Child property. You can change the Child as many times as you like at runtime.
I was able to set the frame control's NavigationUIVisibility to Hidden. This solved the problem for me. I am using Visual Studio 2010 though so it might not be applicable to older VS versions.
Ian Griffiths, what you suggest increases the workload on the developer substantially. And you are stepping outside of the underlying paradigm of XAML.
In my case I'm developing a game application and have chosen WPF as the UI platform as much as possible. For me that means a intro screen, character select, etc. The purpose of Pages is to encapsulate the navigational need of such an application.
I suspect your downvote is due to your statement "If you don't want navigation...". Upon re-reading the original posters question I see he does want navigation, he just wants it on his own terms. I would have voted you down too. YotaXP's solution neglects the issues with using a User Control, particularly if it may contain other User Controls. It looks like Chris Calvert came up with an actual solution to the poster's issue within the parameters of the problem.
I would be curios if I could override the navigation hotkeys and such within the existing paragimn but that's properly in its own thread.
If you create a simple button and then choose Edit Template -> Edit a Copy, Blend will automatically generate a style area, along with all the button states (MouseEnter, MouseLeave, Pressed, etc). Nowhere in the generated code does it say that on a "MouseOver" event, change the state to "MouseOver", but it still manages to work!
How does a standard button do it? Is there some sort of AutoEventWireUp going on?
Controls themselves define the states they respect. Unfortunately, there's no magic auto-wiring going on. The Button contains code that determines when the mouse is over it and, in that case, to set it's visual state to MouseOver. The TemplateVisualStateAttribute is what lets Blend know that there is a valid state of a certain on this control, but the code in the control itself is what actually determines what state it is in.
If you are developing your own control, this puts the burden of defining which states your control supports on you, as well as the job of correctly determining which state you are in.
FYI: Most of the built in controls have a list of their supported states in the MSDN documentation. For example, Button for Silverlight 3 is here.
I am building a PDF Viewer using the Atalasoft DotImage libraries. They have a PDF Viewing component, but it doesn't support the Acrobat style PDF continuous layout, I have to display the pages a page at a time.
I need to build sort of a virtualizing scrollable control which has probably 3 PDFViewers in it, the current frame, and the ones immediately before and after. So my question is - how would I do this?
[I've been doing WPF for the last 3 years, and my WinForms experience has turned to mental mush.]
I need to be able to detect which viewers to open, and which to close. How?
You can do this with a Panel. Set AutoScroll = true and AutoScrollMinSize.Height = pages x control.Height. Implement the Scroll event handler and look at the -AutoScrollPosition.Y property to find out what the user is looking at. Change the Location property of the 3 controls and their Page property as necessary.
How would you render a tag cloud within a .NET 2.0+ WinForm application?
One solution that I am thinking of would be using the WebBrowser control and generating to some ad-hoc HTML, but that seems to be a pretty heavy solution.
Am I missing something more simple?
How about creating a user control that implements the Flow layout control? You could have a method for "Add(string tagName)" that would create a link label on the fly and add it to the Flow Layout control. The Flow Layout works just like the web, in that controls added to it are put in the order of creation.
Then you only have to add some logic to resize the Link Label based on hit count for that tag.
Well, you'll want a control with these major features:
Automatic layout of variable sized string snippets
Automatic mouse hit testing
Those are a bit hard to come by in WF controls. A RichTextBox with ReadOnly = true gives you the automatic layout, but not the hit testing. A ListBox with DrawItem can give you variable sized strings and hit testing, but not a natural layout.
I think I would use RTB and make hit testing work with the MouseDown event and GetCharIndexFromPosition(), reading back the tag at the clicked location. You'll need a bit of logic to find the starting and ending white space around the word.