Telerik Forums
UI for WPF Forum
2 answers
221 views
I'm trying to use the TreeViewItem in a RadOutlookBar to provide a navigation system for my app.

I'm trying to use Commands in a MVVM pattern to launch the views...

TreeViewItem lacks a Command property.. is there a way to do this?
k f
Top achievements
Rank 1
 answered on 20 Mar 2010
5 answers
135 views
What properties have replace UseAlternateRowStyle and MultipleSelect?

Q1 2010 is not supporting these and I see nothing in the release notes talking about this and I'm not seeing anything in the intellisense drop downs for a replacement.
Beckie
Top achievements
Rank 1
 answered on 20 Mar 2010
2 answers
123 views
All it shows is an empty rectangle for which one cannot change style or template.
In VS 2010 RC designer, however, it displays correctly.
What can be done to make Expression Blend work with NumericUpDown?
Thanks
Nick Polyak
Top achievements
Rank 1
 answered on 19 Mar 2010
3 answers
65 views
Hi,
   I am using Grid view and have a column defined as below.
  
<telerik:GridViewDataColumn UniqueName="SiteName" Header="SiteName" DataMemberBinding="{Binding SiteName, Mode=TwoWay}"  Width="120" > 
                            <telerik:GridViewDataColumn.CellTemplate> 
                                <DataTemplate> 
                                    <TextBlock Text="{Binding SiteName}" /> 
                                </DataTemplate> 
                            </telerik:GridViewDataColumn.CellTemplate> 
                            <telerik:GridViewDataColumn.CellEditTemplate> 
                                <DataTemplate> 
                                    <TextBox Text="{Binding SiteName, Mode=TwoWay}" MaxLength="20" Loaded="Editor_Loaded" /> 
                                </DataTemplate> 
                            </telerik:GridViewDataColumn.CellEditTemplate> 
                        </telerik:GridViewDataColumn> 
and in code behind I have
private void Editor_Loaded(object sender, RoutedEventArgs e)  
        {  
            Control ctrl = sender as Control;  
            if (ctrl != null)  
            {  
                ctrl.Focus();  
            }  
        } 

When I am in edit mode, I get a textbox. If I do tab the value is saved. If I click anywhere else, the value is not saved. Also, if I am in the last cell, hitting tab goes outside the control and value is not saved. I have to hit shift+tab to save the content. This dramatically alters the user's behaviour.

Is there a way to save the edited value on lost focus? I tried UpdateSourceTrigger=LostFocus too. No luck.
<TextBox Text="{Binding ProcedureName, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" MaxLength="20" Loaded="Editor_Loaded" /> 

Any help would be highly appreciated.
Pooran
Nedyalko Nikolov
Telerik team
 answered on 19 Mar 2010
3 answers
186 views
WPF RadWindow (Q1 2010) is never showing a modal background.

Here is simple example xaml:
Window x:Class="Window1" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
        Title="Window1" Height="400" Width="600" WindowStartupLocation="CenterOwner"
    <Grid> 
        <telerikNavigation:RadWindow ModalBackground="Red" 
                           Name="testObj" Height="100" Width="200" CanClose="True" 
                           WindowStartupLocation="CenterOwner" Background="Beige"/> 
    </Grid> 
</Window> 

Here is the code:
Class Window1  
    Public Sub x() Handles Me.MouseLeftButtonDown 
        testObj.ShowDialog() 
    End Sub 
End Class 

Image is attached.

Any idea what's up?

Thanks
Rosi
Telerik team
 answered on 19 Mar 2010
3 answers
204 views
When I use the WindowClosedEventArgs I need to be able to pass my own variable all the way through so i can use the variable on close.  Can we get an "arg" parameter or something to do this? ATM it looks like i'll have to make a bunch of member variables to hold the state.
Miroslav Nedyalkov
Telerik team
 answered on 19 Mar 2010
4 answers
219 views
I think that RadDocking.GetDockState() of an hidden pane should return
  • either HiddenDockedLeft or DockedLeft for a RadPane hidden left
  • either HiddenDockedTop or DockedTop for a RadPane hidden top
  • either HiddenDockedRight or DockedRight for a RadPane hidden right
  • either HiddenDockedBottom or DockedBottom for a RadPane hidden bottom

Also, it would be great to have PaneStateChanged for after the RadPane had changed.

In my code, I used on LayoutUpdate because I was always one step behind the real tree.
My "workaround" is by getting the property name of the Telerik.Windows.Controls.Docking.AutoHideArea

C# sample:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Data; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Imaging; 
using System.Windows.Shapes; 
using Telerik.Windows.Controls; 
 
namespace QView 
    /// <summary> 
    /// Interaction logic for Window3.xaml 
    /// </summary> 
    public partial class Window3 : Window 
    { 
        public Window3() 
        { 
            InitializeComponent(); 
        } 
 
        private void RadDocumentPane_MouseDoubleClick(object sender, MouseButtonEventArgs e) 
        { 
            // Create a FlowDocument 
            FlowDocument mcFlowDoc = new FlowDocument(); 
 
            // Create a paragraph with text 
            Paragraph para = new Paragraph(); 
            para.Inlines.Add(new Run("I am a flow document. Would you like to edit me? ")); 
            para.Inlines.Add(new Bold(new Run("Go ahead."))); 
 
            // Add the paragraph to blocks of paragraph 
            mcFlowDoc.Blocks.Add(para); 
 
            // Set contents 
            rtb.Document = mcFlowDoc; 
 
            TextPointer start = rtb.Document.ContentStart; 
            TextPointer startPos = start.GetPositionAtOffset(2); 
            TextPointer endPos = start.GetPositionAtOffset(8); 
            TextRange textRange = new TextRange(startPos, endPos); 
            Console.WriteLine(textRange.Text); 
            textRange.ApplyPropertyValue(TextElement.ForegroundProperty, 
                new SolidColorBrush(Colors.Blue)); 
            textRange.ApplyPropertyValue(TextElement.FontWeightProperty, 
                FontWeights.Bold); 
 
            start = rtb.Document.ContentStart; 
            startPos = start.GetPositionAtOffset(7); 
            endPos = start.GetPositionAtOffset(18); 
            textRange = new TextRange(startPos, endPos); 
            Console.WriteLine(textRange.Text); 
            textRange.ApplyPropertyValue(TextElement.ForegroundProperty, 
                new SolidColorBrush(Colors.Red)); 
            textRange.ApplyPropertyValue(TextElement.FontWeightProperty, 
                FontWeights.Bold); 
             
            startPos = rtb.Document.ContentStart; 
            endPos = rtb.Document.ContentEnd; 
            textRange = new TextRange(startPos, endPos); 
            textRange.ClearAllProperties(); 
        } 
 
        private TreeViewItem FindItem(String p_sFind, ItemCollection p_oIC) 
        { 
            foreach (TreeViewItem oTVI in p_oIC) 
            { 
                if (oTVI.Header.ToString() == p_sFind) 
                { 
                    return oTVI; 
                } 
            } 
            return null
        } 
 
        private void TreeSet(RadSplitContainer p_oRSC, TreeViewItem p_oTVI) 
        { 
            TreeViewItem oTVIGroup; 
            TreeViewItem oTVIChild; 
            object o; 
            for (int nIdx = 0; nIdx < p_oRSC.Items.Count;) 
            { 
                o = p_oRSC.Items[nIdx]; 
                if (o is RadSplitContainer) 
                { 
                    RadSplitContainer oRSC = o as RadSplitContainer; 
                    oTVIGroup = new TreeViewItem(); 
                    oTVIGroup.Header = "RadSplitContainer"
                    TreeSet(o as RadSplitContainer, oTVIGroup); 
                    p_oTVI.Items.Add(oTVIGroup); 
                } 
                else if (o is RadPaneGroup) 
                { 
                    RadPaneGroup oRPG = o as RadPaneGroup; 
                    oTVIGroup = new TreeViewItem(); 
                    oTVIGroup.Header = "Group"
                    if (oRPG.Items.Count != 0) 
                    { 
                        foreach (RadPane oRD in (o as RadPaneGroup).Items) 
                        { 
                            oTVIChild = new TreeViewItem(); 
                            oTVIChild.Header = oRD.Header.ToString(); 
                            oTVIGroup.Items.Add(oTVIChild); 
                        } 
                        p_oTVI.Items.Add(oTVIGroup); 
                    } 
                } 
                else 
                { 
                    Console.WriteLine(o.GetType()); 
                } 
                ++nIdx; 
            } 
        } 
 
        private void radDocking1_LayoutUpdated(object sender, EventArgs e) 
        { 
            radTreeView.Items.Clear(); 
 
            TreeViewItem oTVIChild; 
            TreeViewItem oTVIGroup; 
            TreeViewItem oTVIParent; 
            foreach (RadPane oRP in radDocking1.Panes) 
            { 
                if (oRP.IsFloating || oRP.IsFloatingOnly) 
                { 
                    oTVIParent = FindItem("Floating", radTreeView.Items); 
                    if (oTVIParent == null
                    { 
                        oTVIParent = new TreeViewItem(); 
                        oTVIParent.Header = "Floating"
                        radTreeView.Items.Add(oTVIParent); 
                    } 
                    oTVIChild = new TreeViewItem(); 
                    oTVIChild.Header = oRP.Header; 
                    oTVIParent.Items.Add(oTVIChild); 
                } 
                else if (oRP.IsInDocumentHost) 
                { 
                    oTVIParent = FindItem("Documents", radTreeView.Items); 
                    if (oTVIParent == null
                    { 
                        oTVIParent = new TreeViewItem(); 
                        oTVIParent.Header = "Documents"
                        radTreeView.Items.Add(oTVIParent); 
                    } 
                    oTVIChild = new TreeViewItem(); 
                    oTVIChild.Header = oRP.Header; 
                    oTVIParent.Items.Add(oTVIChild); 
                } 
                else if (!oRP.IsPinned) 
                { 
                    Console.WriteLine(radDocking1); 
                    //Telerik.Windows.Controls.Docking.AutoHideArea.NameProperty 
                    //oTVIParent = FindItem(RadDocking.GetDockState(oRP.Parent).ToString(), radTreeView.Items); 
                    oTVIParent = FindItem(oRP.Parent.GetValue(Telerik.Windows.Controls.Docking.AutoHideArea.NameProperty).ToString(), radTreeView.Items); 
                    Console.WriteLine("RadDocking.GetDockState() with the RadPanel : " + RadDocking.GetDockState(oRP).ToString()); 
                    Console.WriteLine("RadDocking.GetDockState() with the parent(Telerik.Windows.Controls.Docking.AutoHideArea) of the RadPanel : " + RadDocking.GetDockState(oRP.Parent).ToString()); 
                    Console.WriteLine("Name of the Telerik.Windows.Controls.Docking.AutoHideArea : " + oRP.Parent.GetValue(Telerik.Windows.Controls.Docking.AutoHideArea.NameProperty).ToString()); 
                    if (oTVIParent == null
                    { 
                        oTVIParent = new TreeViewItem(); 
                        oTVIParent.Header = oRP.Parent.GetValue(Telerik.Windows.Controls.Docking.AutoHideArea.NameProperty).ToString(); 
                        radTreeView.Items.Add(oTVIParent); 
                    } 
                    oTVIChild = new TreeViewItem(); 
                    oTVIChild.Header = oRP.Header; 
                    oTVIParent.Items.Add(oTVIChild); 
                } 
            } 
 
            foreach (RadSplitContainer oRSC in radDocking1.Items) 
            { 
                oTVIParent = FindItem(RadDocking.GetDockState(oRSC).ToString(), radTreeView.Items); 
                if (oTVIParent == null
                { 
                    oTVIParent = new TreeViewItem(); 
                    oTVIParent.Header = RadDocking.GetDockState(oRSC).ToString(); 
                    radTreeView.Items.Add(oTVIParent); 
                } 
                TreeSet(oRSC, oTVIParent); 
            } 
        } 
 
        private void radDocking1_PreviewShowCompass(object sender, Telerik.Windows.Controls.Docking.PreviewShowCompassEventArgs e) 
        { 
            /*if (e.TargetGroup != null)
            {
                e.Compass.IsCenterIndicatorVisible = CanDockIn(e.DraggedSplitContainer, e.TargetGroup, DockPosition.Center);
                e.Compass.IsLeftIndicatorVisible = CanDockIn(e.DraggedSplitContainer, e.TargetGroup, DockPosition.Left);
                e.Compass.IsTopIndicatorVisible = CanDockIn(e.DraggedSplitContainer, e.TargetGroup, DockPosition.Top);
                e.Compass.IsRightIndicatorVisible = CanDockIn(e.DraggedSplitContainer, e.TargetGroup, DockPosition.Right);
                e.Compass.IsBottomIndicatorVisible = CanDockIn(e.DraggedSplitContainer, e.TargetGroup, DockPosition.Bottom);
            }
            e.Canceled = !(CompassNeedsToShow(e.Compass));*/ 
        } 
 
        private void radDocking1_PaneStateChange(object sender, Telerik.Windows.RadRoutedEventArgs e) 
        { 
             
        } 
    } 
 

XAML:

<Window x:Class="QView.Window3" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"  
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    Title="Window3" Height="300" Width="300" > 
    <Grid> 
        <Grid.RowDefinitions> 
            <RowDefinition Height="auto"/> 
            <RowDefinition /> 
        </Grid.RowDefinitions> 
        <telerik:RadMenu x:Name="radMenu" ClickToOpen="False" Grid.Row="0"
            <telerik:RadMenuItem Header="_File"
                <telerik:RadMenuItem Header="New _Tab" > 
                </telerik:RadMenuItem> 
                <telerik:RadMenuItem Header="New _Window"
                </telerik:RadMenuItem> 
                <telerik:RadMenuItem Header="_Open"
                </telerik:RadMenuItem> 
                <telerik:RadMenuItem Header="_Edit with Microsoft Office Word" /> 
            </telerik:RadMenuItem> 
        </telerik:RadMenu> 
        <Grid Grid.Row="1"
            <my:RadDocking x:Name="radDocking1" Height="auto"  PaneStateChange="radDocking1_PaneStateChange" PreviewShowCompass="radDocking1_PreviewShowCompass" LayoutChangeEnded="radDocking1_LayoutUpdated"
                <my:RadDocking.DocumentHost> 
                    <my:RadSplitContainer> 
                        <my:RadPaneGroup> 
                            <my:RadDocumentPane Header="Document 1" Title="Document 1" IsHidden="False" MouseDoubleClick="RadDocumentPane_MouseDoubleClick"
                                <Grid> 
                                    <RichTextBox x:Name="rtb"
                                        <RichTextBox.Document> 
                                            <FlowDocument x:Name="FlowDoc"
                                                <Paragraph x:Name="Paragraph"
                                                    <Bold>New France (French: Nouvelle-France) 
                                                    <Bold>was the</Bold> 
                                                        <Italic>area</Italic> colonized</Bold> by France in North America during a period extending from the exploration of the Saint Lawrence River, by Jacques Cartier in 1534, to the cession of New France to Spain and Britain in 1763. At its peak in 1712 (before the Treaty of Utrecht), the territory of New France extended from Newfoundland to the Rocky Mountains and from Hudson Bay to the Gulf of Mexico. The territory was then divided in five colonies, each with its own administration: Canada, Acadia, Hudson Bay, Newfoundland (Plaisance),[1]  and Louisiana. The Treaty of Utrecht resulted in the relinquishing of French claims to mainland Acadia, the Hudson Bay and Newfoundland colonies, and the establishment of the colony of ÃŽle Royale (Cape Breton Island) as the successor to Acadia.[2][3] 
                                                </Paragraph> 
                                                <Paragraph> 
                                                    Around 1523, the Italian navigator Giovanni da Verrazzano convinced the king, Francis I, to commission an expedition to find a western route to Cathay (China). Late that year, Verrazzano set sail in Dieppe, crossing the Atlantic on a small caravel  with 53 men. After exploring the coast of the present-day Carolinas  early the following year, he headed north along the coast, eventually anchoring in the Narrows of New York Bay. The first European to discover the site of present-day New York, he named it Nouvelle-Angoulême in honour of the king, the former count of Angoulême. Verrazzano’s voyage convinced the king to seek to establish a colony in the newly discovered land. Verrazzano gave the names Francesca and Nova Gallia to that land between New Spain (Mexico) and English Newfoundland.[4] 
                                                </Paragraph> 
                                                <Paragraph> 
                                                    In 1534, Jacques Cartier planted a cross in the Gaspé Peninsula and claimed the land in the name of King Francis I. It was the first province of New France. However, initial French attempts at settling the region met with failure. French fishing fleets, however, continued to sail to the Atlantic coast and into the St. Lawrence River, making alliances with First Nations  that would become important once France began to occupy the land. French merchants soon realized the St. Lawrence region was full of valuable fur-bearing animals, especially the beaver, which was becoming rare in Europe. Eventually, the French crown decided to colonize the territory to secure and expand its influence in America. 
                                                </Paragraph> 
                                                <Paragraph> 
                                                    Another early French attempt at settlement in North America was Fort Caroline, established in what is now Jacksonville, Florida, in 1564. Intended as a haven for Huguenots, Caroline was founded under the leadership of René Goulaine de Laudonnière and Jean Ribault. It was sacked by the Spanish led by Pedro Menéndez de Avilés which then established the settlement of St. Augustine on September 20, 1565. 
                                                </Paragraph> 
                                            </FlowDocument> 
                                        </RichTextBox.Document> 
                                    </RichTextBox> 
                                </Grid> 
                            </my:RadDocumentPane> 
                            <my:RadDocumentPane Header="Document 2" Title="Document 2" IsHidden="False"
                                <Grid /> 
                            </my:RadDocumentPane> 
                            <my:RadDocumentPane Header="Document 3" Title="Document 3" IsHidden="False"
                                <Grid /> 
                            </my:RadDocumentPane> 
                        </my:RadPaneGroup> 
                    </my:RadSplitContainer> 
                </my:RadDocking.DocumentHost> 
                <my:RadSplitContainer Orientation="Vertical" InitialPosition="DockedLeft" Width="150"
                    <my:RadPaneGroup> 
                        <my:RadPane Header="Pane 1" CanDockInDocumentHost="True"
                            <Grid> 
                                <telerik:RadTreeView x:Name="radTreeView"/> 
                            </Grid> 
                        </my:RadPane> 
                        <my:RadPane Header="Pane 2"
                            <Grid> 
                            </Grid> 
                        </my:RadPane> 
                    </my:RadPaneGroup> 
                </my:RadSplitContainer> 
                <my:RadSplitContainer Orientation="Horizontal" InitialPosition="DockedLeft" Width="150"
                    <my:RadPaneGroup> 
                        <my:RadPane Header="Pane 3"
                            <Grid> 
                            </Grid> 
                        </my:RadPane> 
                        <my:RadPane Header="Pane 4"
                            <Grid> 
                            </Grid> 
                        </my:RadPane> 
                    </my:RadPaneGroup> 
                </my:RadSplitContainer> 
            </my:RadDocking> 
        </Grid> 
    </Grid> 
</Window> 
 

Miroslav Nedyalkov
Telerik team
 answered on 19 Mar 2010
3 answers
177 views
I have a RadCalendar set to show 3 rows (months) and SelectionMode is set to Multiple. When you click the days, they highlight, which is great. How do I get the collection of selected dates, and on what event is a day added to the collection? I want to populate a listbox with the selected dates in date order each time a day is selected or unselected.
Hristo
Telerik team
 answered on 19 Mar 2010
1 answer
79 views
Hi,
I would like to dock some of my panes only between themselves and not in other panes.
I would like the compass to show only on top of "legitimate" panes.
How can it be achieved?
Thanks
Nick
Hristo
Telerik team
 answered on 19 Mar 2010
1 answer
58 views
Hello,

I intend to display a duration per XCategory, so I bound the YValue DataPointMember to a TimeSpan. I got an exception then. If I do bind to double value, everything works fine.

What should I do here ? I want to have a good formating on the bar and y-axis here (e.g. 2 Minutes, 1 hour, or 00:11:00).

Thanking you in anticipation
Velin
Telerik team
 answered on 18 Mar 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?