Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all 7205 articles
Browse latest View live

How to: Implement Browser-style Tab Behavior in DXTabControl Using StretchView

$
0
0

One of DXTabControl's supported views is TabControlStretchView. This view automatically stretches tab headers to all available space in the Tab Header Panel and allows dragging tabs in the browser-style manner. To control the dragging behavior, use the DragDropMode property. In addition to this functionality, TabControlStretchView allows pinning tabs to the right or left side of the Tab Header Panel. To pin a tab, use the TabControlStretchView.PinMode attached property.


How to: Change Tab Background in DXTabControl and Keep the Default Gradient and Highlight Effects

$
0
0

To change tab background in DXTabControl, use the BackgroundColor property. This property changes the tab background color when it's not active and affects the line color displayed in the tab header when it's active:


If you wish to customize header colors in different states (Selected, Focused, Hover, Normal), use the approach demonstrated at How To: Change the Tab Background in DXTabControl when a Tab is Selected, Focused, or Hovered.

To learn more about appearance customization in DXTabControl, refer to Appearance Customization.

How to: Change the Tab Background in DXTabControl when a Tab Is Selected, Focused Or Hovered

$
0
0

In DXTabControl, tabs have different colors when they are selected, focused, or hovered. In this example, it's demonstrated how to change the tab background for all these states. 
You can do this by using the following properties:
-DXTabItem.NormalBackgroundTemplate is responsible for the default tab item header background.
-DXTabItem.HoverBackgroundTemplate is responsible for the tab item header appearance when it is under a mouse pointer.
-DXTabItem.SelectedBackgroundTemplate is responsible for the tab item header appearance when it is selected.
-DXTabItem.FocusedBackgroundTemplate is responsible for the tab item header appearance when it is focused.

You can also customize DXTabControl's background using the BackgroundTemplate property.

If you wish to keep the default state effects, use the approach demonstrated at How To: Change Tab Background in DXTabControl and Keep the Default Gradient and Highlight Effects.

To learn more about appearance customization in DXTabControl, refer to Appearance Customization.

How to: Customize DXTabControl's Content Header, Content Footer and Control Box Areas

How to: Automatically Uncheck Items in a Group When One Item Is Checked

$
0
0
This example demonstrates how to create a group of items where only one item can be checked. To implement this functionality, a special bar item is used: BarItemSelector. When you select an item located in BarItemSelector, all other items are automatically deselected.

How to: Use Services Implementing the IDocumentManagerService Interface

How to: Choose DevExpress Themes Using BarSplitButtonItem

$
0
0

This example demonstrates how to use the BarSplitButtonItem to select themes. All logic is incorporated into BarSplitItemThemeSelectorBehavior. So, to activate this functionality, assign the behavior to the item:

[XAML]
<dxb:BarSplitButtonItem><dxmvvm:Interaction.Behaviors><dxb:BarSplitItemThemeSelectorBehavior/></dxmvvm:Interaction.Behaviors></dxb:BarSplitButtonItem>

How to: Create a Context Menu With DevExpress Bar Items


How to: Create a Radial Context Menu

$
0
0

This example shows how to assign a RadialContextMenu to a text box and initialize the menu with items.

To assign the RadialContextMenu to the text box, the BarManager.DXContextMenu attached property is used.

The radial menu displays three regular buttons (Copy, Cut and Paste) and one sub-menu (Select All) that provides access to two additional items (Clear and Select All). Commands are assigned to the buttons with the Command properties.

The radial menu's DataContext is bound to the window's DataContext. This DataContext is set to a RadialContextMenuViewModel class descendant, which is automatically generated by the DevExpress.Mvvm.POCO.ViewModelSource object. This descendant automatically generates commands for all public methods in the RadialContextMenuViewModel class (the ClearSelectionCommand is generated for the ClearSelection method).

How to: Merge Bars When They are Used in Standard Controls

$
0
0

This example demonstrates the merging behavior of bars when they are used in controls that don't support automatic merging.



The example creates a TabControl in which a Tab contains three MainMenuControls: 1) an empty menu called 'elementHost', 2) a menu with 'Cut', 'Copy' and 'Paste' commands, 3)a menu with 'Left', 'Center' and 'Right' commands.
The second and third MainMenuControls will be merged to the first MainMenuControl.

The merging feature is enabled with the ElementMergingBehavior property attached to the Tab. This property is set to 'InternalWithInternal', which means that the Tab's internal elements are merged with other internal elements that are defined in parent name scopes. 
The 'elementHost' MainMenuControl belongs to the name scope inherited from the Window object (a name scope is implicitly created for each Window object). The IsScopeOwner properties set for the second and third MainMenuControls define child name scopes. Thus, these MainMenuControls will be merged to the 'elementHost' MainMenuControl (defined in the parent name scope).

Note:
If you want to merge the Tab's second and third MainMenuControls to the Window's topmost MainMenuControl (the one that contains 'File', 'Settings' and 'Exit' commands), replace the Tab's property setting:
dxb:MergingProperties.ElementMergingBehavior="InternalWithInternal"
with:
dxb:MergingProperties.ElementMergingBehavior="InternalWithExternal"

How to: Merge Bars in Controls That Support Automatic Merging

$
0
0
The automatic bar merging is supported by several DevExpress controls:
- DXTabControl - see DXTabControl.AllowMerging Property to learn more on how to enable it.
- DXDocking - see MDI Bar Merging.

In this example, the DockLayoutManager component implements the tabbed MDI interface. The main application window, as well as tabs, contains MainMenuControls which are merged when a document is selected or expanded in the MDI mode. 

There are several properties you can use to control the merging process in DockLayoutManager:
- DockLayoutManager.MDIMergeStyle - using this property, it is possible to disable merging or specify what panels will be merged: only active panels or all selected tabs/maximized MDI panels.
- DockLayoutManager.AllowMergingAutoHidePanels.
- BarItem.MergeType - specifies whether an item will be removed, replaced or added to the parent bar
- BarItem.MergeOrder - controls the order in which bar items are displayed after merging.

GridView - How to automatically resize the grid to 100% width and height when it is placed inside a resizable PopupControl

$
0
0

This example illustrates how to set the grid's width and height to 100% when it is placed inside a resizable container. The How to use the GridView extension in a Full Screen mode (100% browser Width and Height) example describes how to accomplish this task when the grid is paced into the page directly. If the grid is placed inside some container, it is necessary to handle container resizing to set the grid height:

[C#]
settings.ClientSideEvents.AfterResizing="function(s, e){ GridView.SetHeight(document.getElementById('containerDiv').clientHeight); }";

 GridView is placed inside the div element with height and width equal to 100% to get the client height of the container's content area:

[C#]
ViewContext.Writer.Write("<div id='containerDiv' style='height:100%; widht:100%'>");Html.RenderAction("GridViewPartial");ViewContext.Writer.Write("</div>");

How to: Initiate Navigation between Views from the View Model Using FrameNavigationService

$
0
0

The FrameNavigationService provides methods to navigate between Views within a NavigationFrame. This example shows how to use this service.

In this example, the MainWindow contains a NavigationFrame, which shows a HomeView at startup. The HomeView contains a Tile, which invokes a command to navigate to a DetailView when clicked. The DetailView contains the Back button for backward navigation.

Question Comments

Added By: Elliott Mehrbach at: 10/3/2013 9:17:40 AM    

This example does not work. The back button is not functioning properly. In fact I based an application on this example and it worked fine. Now its back buttons are not working. Problem with recent upgrade?

Added By: Alex Zeller (DevExpress) at: 10/4/2013 6:43:04 AM    

The navigation bug you're observing in this example has been fixed in the scope of the Q521235 ticket. Please upgrade the components when the following minor update is released or request a hotfix in our Support Center.
Thank you, Alex.

Added By: David Barrientos Velasco at: 10/25/2013 6:45:15 AM    

I was able to run the example, but now I would like to do it with ViewModels that have parameters in their constructor. How can I do that

Added By: Carlton Guc at: 2/25/2014 6:40:39 AM    

Can you please show an example of this in Silverlight?

Added By: Alex Zeller (DevExpress) at: 2/27/2014 4:40:34 AM    

An example for Silverlight can be found here: How to: Navigate between Views via FrameNavigationService

Added By: Kunal Mistry at: 12/30/2014 4:41:05 AM    

Ok Thanks for showing me this method.

This is one which I can use it for later views.

But how will you navigate to different views without using a Button Click ....

How will you navigate from View 1 to View 2 after 5 seconds timer ?

Added By: Alexander S (DevExpress Support) at: 12/30/2014 5:11:30 AM     Hi Kunal,
As I can see, you duplicated your last question in the T191867: How to navigate to another view programmatically using NavigationFrame ticket. In the future, please do not post the same questions in multiple tickets. We track changes in all our tickets, and in any case, we will do our best to answer you during 24 hours. Thank you for your understanding in advance.

How to implement a theme selector based on a bar item

$
0
0

This example demonstrates how to implement the WinForm SkinHelper class functionality in WPF applications (ThemeHelper) that populate an existing RibbonGalleryBarItem or any menu (PopupMenu or BarSubItem) with items that correspond to DevExpress themes.

The basic logic is implemented in the ThemeHelper class.

Update:

Starting with v14.1, we introduced the RibbonGalleryItemThemeSelectorBehavior, BarSubItemThemeSelectorBehavior, and BarSplitItemThemeSelectorBehavior classes that automatically populate a corresponding bar item with all available themes:

[XAML]
<dxr:RibbonGalleryBarItemx:Name="ribbonGalleryBarItem1"....><dxmvvm:Interaction.Behaviors><dxr:RibbonGalleryItemThemeSelectorBehavior/></dxmvvm:Interaction.Behaviors>

How to: Create Items with Subitems in TileBar Using XAML

$
0
0

This example shows how to populate TileBar in XAML. To add an item into TileBar, add the TileBarItem element into the TileBar.Items collection. Please note that Items is a content property, so you can skip its tag when using it in XAML. To show an image in TileBarItem, use the TileGlyph property. 


How to: Bind TileBar to a Collection of Items

$
0
0

To use TileBar according to the MVVM, pattern, you can generate TileBarItems from a collection. To accomplish this task, assign a collection to the TileBar.ItemsSource property. To change properties of generated TileBarItems, use the TileBar.ItemContainerStyle property. If it's necessary to build a multi-level hierarchy, put TileBar into TileBarItem.FlyoutContentTemplate. 

How to: Create TileNavPane Navigation Buttons and Categories in XAML

$
0
0

This example shows how to create a TileNavPane, populate it with navigation elements and add custom buttons to the nav bar.

In the XAML markup, four buttons are added to the NavButtons collection. Buttons added to this collection are displayed in the nav bar. The first, which is aligned at the left margin of the nav bar, is the Main Button. The IsMain property of this button is set to true. Other buttons are aligned to the right using the HorizontalAlignment property. The second button contains items, and so a drop-down tile bar is invoked when this button is clicked. Button glyphs are differently aligned (theGlyphAlignment property) and the rightmost button does not have a textual content (the Content property). All glyphs are specified to be displayed with the glyph theming feature enabled (the AllowGlyphTheming property).

One category (TileNavCategory) is added the Categories collection. This category contains one child item, which in turn contains two sub-items. The textual and graphical content of tiles is specified with the TileContent and TileGlyph properties. Textual content of the corresponding buttons in the nav bar is specified with the Content property.

How to: Generate Items in TileNavPane from a Collection

$
0
0

This example demonstrates how TileNavPane can be used with the MVVM pattern. TileNavPane has three levels: categories, items and subitems. To generate categories, bind a collection to the TileNavCategory.CategoriesSource property. To generate items, use TileNavCategory.ItemsSource. If it's necessary to generate subitems, use the TileNavItem.ItemsSource property. 

How to: Use the AppBar Control to Create a Menu That Is Shown on Top or Bottom of the Window

$
0
0

This example shows how to create an app bar containing custom regular and toggle buttons, the predefined Exit button, and the button that displays a flyout when clicked.

In this example, the AppBar control is populated with the AppBarButton and AppBarToggleButton objects, which are divided into groups using the AppBarSeparator objects. To display the predefined Exit button, the IsExitButtonEnabled property is set to True.

The button captions are specified using the AppBarButton.Label property. The HorizontalAlignment property specifies the button alignment relative to the app bar.

The CommandButton.Glyph property is used to provide the buttons with icons from the DX Image Gallery. The glyph theming feature is enabled for all buttons and the glyph height is set using the Style declared in the app bar's Resources. You can also use the button's Content property to specify the button icons. See the Pin button — the icon for this button is specified using the Unicode symbol that corresponds to the glyph in the Segoe UI Symbol font. For more information about how to use Segoe UI Symbol icons, see Guidelines on MSDN.

The Rotate button displays the flyout when clicked. The button's Flyout property allows you associate the Flyout or MenuFlyout control with the button.

How to: Use WinUIDialogWindow and WinUIMessageBox Controls

$
0
0

This Code Example demonstrates how to use the WinUIDialogWindow and WinUIMessageBox controls. The example contains two projects: one demonstrates how to use the controls in the MVVM pattern, and the other - in code behind. The first project uses special servicesWinUIDialogService and WinUIMessageBoxService. In the second project, the dialog and MessageBox are shown using the WinUIDialogWindow.ShowDialogWindow and WinUIMessageBox.Show methods.

Question Comments

Added By: Jaime López Portillo at: 1/14/2015 10:53:33 AM    

I can't seem to find any documentation regarding WinUIDialogWindow and WinUIMessageBox detailing their properties, constructors and methods, can you please provide me the full documentation link?

Added By: Andrey Marten (DevExpress Support) at: 1/14/2015 12:08:47 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T196769: Where the documentation for WinUIDialogWindow and WinUIMessageBox can be found. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Thanks,
Andrey

Added By: JRelyea at: 4/12/2015 10:21:13 AM    

I'm new to DevExpress.

Something seems to be very wrong with your example, as outlined below:

Something's not right with the following line because it constantly gets pounded and causes a sustained CPU usage at 30% (dual core 2.0gHz I7). Close the dialog window and the CPU drops back to 0%.

      bool OnRegisterCommandCanExecute(CancelEventArgs parameter) { return !string.IsNullOrEmpty(UserName); }

Do you have a working example that doesn't significantly impact a CPU? A dialog window should never consume CPU resources waiting to be closed.

Thank you

Added By: Andrey Marten (DevExpress Support) at: 4/13/2015 12:50:15 AM    


Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T229667: WinUIDialogService - CPU usage increases if the command's CanExecute method is implemented. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Thanks,
Andrey

Viewing all 7205 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>