Showing posts with label Silverlight. Show all posts
Showing posts with label Silverlight. Show all posts

May 22, 2012

BeginGroup in WPF Devexpress Ribbon


Problem:
- I can't find "BeginGroup" in WPF Ribbon! is there any solution ...
- Does the silverlight ribbon bar items have the begingroup option? Can't find it anywhere.
- How do you do a BeginGroup in the application menu using WPF or SL ...

Solution:
Just used of a BarItemLinkSeparator in XAML instead of BeginGroup property.

XAML:
<dxr:RibbonPageGroup>
    <dxb:BarButtonItemLink BarItemName="barButtonItemFind" />
    <dxb:BarButtonItemLink BarItemName="barButtonItemBookmark" />
    <dxb:BarItemLinkSeparator />
    <dxb:BarButtonItemLink BarItemName="barButtonItemFirst"/>
    <dxb:BarButtonItemLink BarItemName="barButtonItemPrevious" />
    <dxb:BarButtonItemLink BarItemName="barButtonItemNext" />
    <dxb:BarButtonItemLink BarItemName="barButtonItemLast" />
</dxr:RibbonPageGroup>

June 01, 2011

WPF SelectedValue for TreeView

Questions:
- How to programmatically select an Item in a WPF TreeView
- How to programmatically selecting an Item in a WPF TreeView
- How to SelectedItem in a WPF TreeView
- How to set SelectedItem or SelectedValue in C#/WPF TreeView
- WPF TreeView SelectedItem should have set accessor …
- How to programmatically change the SelectedItem in a WPF TreeView

Solution:
The Solution is simple and quick with just a little method
TreeViewItem matchItam = SelectTreeViewItem(this.treeView1.Items, "sample value");

The code is here
private TreeViewItem SelectTreeViewItem(ItemCollection Collection, String Value)
{
    if (Collection == null) return null;
    foreach(TreeViewItem Item in Collection)
    {
        /// Find in current
        if (Item.Header.Equals(Value))
        {
            Item.IsSelected = true;
            return Item;
        }

        /// Find in Childs
        if (Item.Items != null)
        {
            TreeViewItem childItem = this.SelectTreeViewItem(Item.Items, Value);
            if (childItem != null)
            {
                Item.IsExpanded = true;
                return childItem;
            }
        }
    }
    return null;
}