Telerik Forums
UI for WPF Forum
4 answers
60 views

 

*I am using telerik:RadSplitContainer to wrap one paneGroup (and will holds more panes)

 The first Radpane is starting with the app, the second is floating RadPane that i am docked to the first RadPaneGroup and i want to change his size)

The scenario:

1. Appliction start with one RadPane

My start code:
 <telerik:RadDocking x:Name="dockEngineering" 
   <telerik:RadDocking.DocumentHost>
       <telerik:RadSplitContainer x:Name="MiddleContainer">
             <telerik:RadPaneGroup x:Name="myPaneGroup">
              <telerik:RadPane  Header="1" >
                      <user control/>
                </telerik:RadPane>
          </telerik:RadPaneGroup>
        </telerik:RadSplitContainer>
    </telerik:RadDocking.DocumentHost>
 </telerik:RadDocking>

2.Double click on a button open a floating RadPane (create from code)

3. I Docked the floating RadPane to the existing radPaneGroup (myPaneGroup)

Code for step 2 and 3:

creating RadPane from code and add it to the myPaneGroup :

myRadpane = new MyRadPane(myPaneGroup)    //MyRadPane is RadPane user control
myPaneGroup.Items(myRadpane )                         //add the radpane to specific PaneGroup
makeFloatingDockable()                                           //make it float

4. now in my application I have 2 panes (under the same RadPaneGroup ) side by side (looks ok in the UI)

 

*************************The problem**************

I want to enlarge\decrease the size of one of them - how can i do it?

Thanks

shay
Top achievements
Rank 1
 answered on 07 Jun 2016
1 answer
194 views

<telerik:RadButton x:Name="button" Width="48" Height="40" BorderThickness="0" Foreground="{x:Null}"  MouseLeftButtonDown="button_MouseLeftButtonDown" MouseLeftButtonUp="button_MouseLeftButtonUp" MouseUp="button_MouseUp" MouseDown="button_MouseDown">

RadButton mouse event doesn't work.

Martin
Telerik team
 answered on 07 Jun 2016
1 answer
145 views

Dear team,

I've a problem with IsExpandedBinding on refreshing data. It's a user experience problem:

When I reload data the control first collapse all nodes and then it expands expanded nodes. This expand status change is very fast but visible and not very nice.

I don't know if TreeListView works like this, if is a problem of my code or if exist some way of avoid this behavior. I would find a way of refresh control after set the expand status of all nodes.

This is the header of my control:

<telerik:RadTreeListView                    
     IsExpandedBinding="{Binding IsExpanded, Mode=TwoWay}"                                        
     AutoGenerateColumns="False"
     IsDragDropEnabled="True"
     IsReadOnly="False"
     ItemsSource="{Binding PivotedItems}"
     SelectedItem="{Binding CurrentPivotedItem, Mode=TwoWay}">

 

Thank you in advance!

 

 

Dilyan Traykov
Telerik team
 answered on 07 Jun 2016
1 answer
270 views

Dear team,

I need to create an slider with multiple ranges. It means that I need a minimum of 4 thumbs and I don't know if this behavior is possible with RadSlider.

Telerik's slider webpage annouces that "Single or Multiple Thumbs Support". Multiple means 2? or more than 2?

Thanks in advance.

 

Martin Ivanov
Telerik team
 answered on 07 Jun 2016
13 answers
545 views

Hi. I write WPF MVVM Prism 6 modular application where I try to use RadTreeView. I add items to RadTreeView through ObservableCollection (to which RadTreeView is bound) using the "Add" method of the collection. I begin to add items to root item of the tree. After completion of code of adding of a child item to tree root item the "+" appears on the left of this root item. When I click on this "+" by the mouse it turns into "-" but added item is not visible in the RadTreeView. Below is the complete code of the class representing the type of element added (as child) to the tree root item:

public class Group : ProfileElementType, IEditableObject
{
    /// <summary>
    /// Device profile elements group structure.
    /// </summary>
    struct GroupData
    {
        /// <summary>
        /// Group name (for example, "RealtimeClock).
        /// </summary>
        internal string name;
        /// <summary>
        /// Brief description
        /// </summary>
        internal string description;
        /// <summary>
        /// Child elements collection.
        /// </summary>
        internal ObservableCollection<ProfileElementType> _childProfileElenents;
    }
 
    #region Fields
    /// <summary>
    /// Group data after their changing.
    /// </summary>
    private GroupData _newGroupData;
    /// <summary>
    /// Old data buffer.
    /// </summary>
    private GroupData _backupGroupData;
    /// <summary>
    /// Edit mode flag.
    /// </summary>
    private bool _isEditMode = false;
     
    #endregion
 
    #region Constructor
    /// <summary>
    /// Creates instance of Group.
    /// </summary>
    public Group()
    {
        this.ElementType = this.GetType();
        this.ElementTypeName = this.ElementType.Name;
        this._newGroupData = new GroupData();
        this._newGroupData.name = string.Empty;
        this._newGroupData.description = string.Empty;
        this.ChildProfileElenents = new ObservableCollection<ProfileElementType>();
    }
    #endregion
 
    #region Properties
    /// <summary>
    /// Gets or sets group name.
    /// </summary>
    [Display(Description = "The name of the group."]
    public string Name
    {
        get { return this._newGroupData.name; }
        set { this._newGroupData.name = value; }
    }
    /// <summary>
    /// Brief description of the group.
    /// </summary>
    [Display(Description = "Brief description of group."]
    public string Description
    {
        get { return this._newGroupData.description; }
        set { this._newGroupData.description = value; }
    }
    /// <summary>
    /// Group child elements collection.
    /// </summary>
    [Browsable(false)]
    public ObservableCollection<ProfileElementType> ChildProfileElenents { get; set; }
    #endregion
 
    #region Methods
    /// <summary>
    /// String representation of instance of Group.
    /// </summary>
    /// <returns></returns>
    public override string ToString()
    {
        StringWriter stringWriter = new StringWriter();
        stringWriter.Write(this.ElementTypeName);
        stringWriter.Write(": ");
        stringWriter.Write(this.Name);
        stringWriter.Write(" ");
        stringWriter.Write(this.Description);
        return stringWriter.ToString();
    }
    #endregion
 
    #region IEditableObject implementation
    /// <summary>
    /// Begins to edit.
    /// </summary>
    public void BeginEdit()
    {
        if(!this._isEditMode)
        {
            this._backupGroupData = this._newGroupData;
            this._isEditMode = true;
        }
    }
    /// <summary>
    /// Cancels edit results.
    /// </summary>
    public void CancelEdit()
    {
        if (this._isEditMode)
        {
            this._newGroupData = this._backupGroupData;
            this._isEditMode = false;
        }
    }
    /// <summary>
    /// Accepts edit results.
    /// </summary>
    public void EndEdit()
    {
        if (this._isEditMode)
        {
            this._backupGroupData = new GroupData();
            this._isEditMode = false;
        }
    }
    #endregion
}

Below isProfileElementType base class. It is base for both Gruop and Register classes.

public class ProfileElementType : IProfileElementType
{
   #region Fields
   /// <summary>
   /// Profile element type - Register or Group (група).
   /// </summary>
   private Type _elementType;
   /// <summary>
   /// Profile element type name - "Register" or "Group".
   /// </summary>
   private string _elementTypeName;
   #endregion
 
   #region Properties
   /// <summary>
   /// Gets or sets profile element type name string - "Register" or "Group".
   /// </summary>
   [Browsable(false)]
   public string ElementTypeName
   {
       get { return this._elementTypeName; }
       set { this._elementTypeName = value; }
   }
   #endregion
 
   #region IProfileElementType implementation
   /// <summary>
   /// Gets or sets profile element type - Register or Group.
   /// </summary>
   [Browsable(false)]
   public Type ElementType
   {
      get { return this._elementType; }
      set { this._elementType = value; }
   }
    #endregion
 }

Below is definition of instance of group (root item element) in view model:

/// <summary>
/// The tree root element. Its child elements collection is for organization of the device profile tree.
/// </summary>
private Group _profileTreeRoot;
public Group ProfileTreeRoot
{
   get { return this._profileTreeRoot; }
   set { this.SetProperty(ref this._profileTreeRoot, value); }
}
// This code in view model constructor:
this.ProfileTreeRoot = new Group();

In my application I have two classes of tree nodes: "Group" and "Register". I won't show Register class definition (because I'm experimenting with Group class now) but ItemStyleSelector class is below:

public class ItemStyleSelector : StyleSelector
{
   public override Style SelectStyle(object item, DependencyObject container)
   {
      if (item is Group)
         return this.GroupStyle;
      else if (item is Register)
         return this.RegisterStyle;
      return null;
   }
 
   public Style GroupStyle { get; set; }
   public Style RegisterStyle { get; set; }
}

Below is XAML of view in wich RadTreView is located (this XAML is shortened here in the post):

        <Grid.Resources>
            <!--Profile elements group style-->
            <Style x:Key="GroupItemStyle" TargetType="telerik:RadTreeViewItem">
                <Setter Property="Foreground" Value="Black" />
                <Setter Property="FontStyle" Value="Normal" />
                <Setter Property="FontWeight" Value="Normal"/>
                <Setter Property="DefaultImageSrc" Value="/Images/Group.png" />
                <Style.Triggers>
                    <Trigger Property="IsExpanded" Value="True">
                        <Trigger.Setters>
                            <Setter Property="Foreground" Value="ForestGreen" />
                            <Setter Property="FontStyle" Value="Italic" />
                            <Setter Property="FontWeight" Value="SemiBold"/>
                        </Trigger.Setters>
                    </Trigger>
                </Style.Triggers>
            </Style>
            <!--Device register style (just in case only)-->
            <Style x:Key="RegisterItemStyle" TargetType="telerik:RadTreeViewItem">
                <Setter Property="Foreground" Value="Black" />
                <Setter Property="FontStyle" Value="Normal" />
                <Setter Property="DefaultImageSrc" Value="/Images/File.png" />
            </Style>
            <!--Profile elements group template-->
            <HierarchicalDataTemplate DataType="{x:Type model:Group}" ItemsSource="{Binding ChildProfileElenents}">
                <TextBlock Text="{Binding Name}" />
            </HierarchicalDataTemplate>
            <!--Register template (just in case only)-->
            <DataTemplate DataType="{x:Type model:Register}">
                <TextBlock Text="{Binding Name}" />
            </DataTemplate>
            <!--Style selector-->
            <local:ItemStyleSelector x:Key="ItemStyleSelector"
                                       GroupStyle="{StaticResource GroupItemStyle}"
                                       RegisterStyle="{StaticResource RegisterItemStyle}"/>
        </Grid.Resources>
 
<!--Below is RadTreeView markup itself:-->
<telerik:RadTreeView x:Name="DeviceProfileTree" Grid.Row="1" Grid.Column="0">
    <telerik:RadTreeViewItem Header="{Binding RootHeader}"
                                     ItemContainerStyleSelector="{StaticResource ItemStyleSelector}"
                                     ItemsSource="{Binding ProfileTreeRoot.ChildProfileElenents}"/>
    <telerik:EventToCommandBehavior.EventBindings>
        <telerik:EventBinding
            Command="{Binding HandleProfileElementSelectionCommand}"
            EventName="Selected"
            PassEventArgsToCommand="True"/>
    </telerik:EventToCommandBehavior.EventBindings>
</telerik:RadTreeView>

Below is RootHeader definition in the view model:

private string _rootHeader;
public string RootHeader
{
   get { return this._rootHeader; }
   set { this.SetProperty(ref this._rootHeader, value); }
}
// This code in the view model constructor:
this.RootHeader = "Flow Meter";

Below is HandleProfileElementSelectionCommand command method (though here it does not matter as it seems to me):

private void handleProfileElementSelection(object parameter)
{
    if (!this._isProfileElementSelected)
       this._isProfileElementSelected = true;
    RadRoutedEventArgs args = parameter as RadRoutedEventArgs;
    if ((args.Source as RadTreeViewItem).IsRootItem)
       this._isRootItemSelected = true;
    else
    {
       if (this._isRootItemSelected)
          this._isRootItemSelected = false;
    }
}

Below is command method for adding of new group:

private void addNewGroup(object parameter)
{
   // If parent element was selected in the RadTreeView:
   if (this._isProfileElementSelected)
   {
      // Set property (to which RadPropertyGrid is bound in view) to new Group.
      this.ProfileElement = new Group();
      this._isAddNewItem = true;
   }
}

Below is ProfileElement definition in the view model:

/// <summary>
/// Device profile element. Can be as Group or as Register that are inherited from it.
/// </summary>
private ProfileElementType _profileElement;
public ProfileElementType ProfileElement
{
   get { return this._profileElement; }
   set { this.SetProperty(ref this._profileElement, value); }
}

Below is command method for saving added Group instance in the RadTreeView:

private void saveChanges(object parameter)
{
    // If new profile element is added to the device profile tree.
    if(this._isAddNewItem)
    {
        // If this element is added as the child of the tree root element.
        if (this._isRootItemSelected)
        {
            if (this.ProfileElement.ElementTypeName == "Group")
               this.ProfileTreeRoot.ChildProfileElenents.Add(this.ProfileElement as Group);
            else
               this.ProfileTreeRoot.ChildProfileElenents.Add(this.ProfileElement as Register);
        }
        else
        {
            // Add to selected group inside root element (not implemented now)
        }
        this._isAddNewItem = false;
    }
    else
    {
        // Save changes for existed selected device profile element (not implemented now).
    }
}

As you can see adding to RadTreeView performs via ObservableCollection to which root node of RadTreeView is bound. Why added child element is not visible? Please help me to eliminate this error. In attach files there are solution structure (in Snapshot_10.png file), RadTreeView in collapsed status after adding the element (in Collapsed_Tree.png file) and RadTreeView in unwrapped status (in Unwrapped_Tree.png file). I hope for your help very much.

Dinko | Tech Support Engineer
Telerik team
 answered on 07 Jun 2016
5 answers
594 views

Hi,

I'm using *Telerik UI for WPF with C#*

I need to be able to sort the top node list of my RadTreeView alphabetically - that's it !

So the user clicks on the header row "Project" and it sorts ASC, click again and it toggles to DESC.

All the examples I've come across are for other Telerik platforms (web or winforms etc.).

My TreeView:

            <telerik:RadTreeView x:Name="ProjectsTreeView" Grid.Row="1"   
telerik:PersistenceManager.StorageId="THOR_ProjectTree" 
ItemsSource="{Binding ProjectData}"
ItemTemplate="{StaticResource Project}"
BorderBrush="Gray" 
ItemsIndent="0"
SelectionMode="Single"
SelectedItem="{Binding SelectedTreeViewItem, Mode=TwoWay}"
ItemContainerStyle="{StaticResource ItemContainerStyle}"
ItemClick="ProjetsTreeView_ItemClick"
BorderThickness="1"/>

 

Please advise (C#),

Barry

Martin Ivanov
Telerik team
 answered on 06 Jun 2016
1 answer
57 views

Hi,

I am having 5 RadGroup inside  RadSplitContainer in my View and data binding is happening through using PRISM and MVVM.

When the RadGroup is getting pinned and unpinned, that particular RadGroup is moving to last in the sequence.

I don't want this behavior. I want the group show in the same sequence as it is declared in XAML.

 

Please suggest how I Can achieved this behavior.

--

Thanks & Regrads

Manoj

 

 

Manoj
Top achievements
Rank 1
 answered on 06 Jun 2016
1 answer
558 views

Hi Team,

Doing hard reboot of the machine (power off by holding the power button and then pwer on again) where our App is running.

Launching the app again after hard reboot is failing with following exception:

Initialization of 'Telerik.Windows.Controls.RadProgressBar' threw an exception.

Exception Source: PresentationFramework

Exception Message: Initialization of 'Telerik.Windows.Controls.RadProgressBar' threw an exception.

Exception StackTrace:  

at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)

at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)

at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)

 at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)

at DomainManagerGUI.DomainGUI..ctor()

at DomainManagerGUI.App.DoLogin(Boolean bIsRedundancyRelogin, Boolean bEvent)

Inner Exception:

----->>>>>

Exception Source: System.Configuration

Exception Message: Configuration system failed to initialize

Exception StackTrace:

at System.Configuration.ConfigurationManager.PrepareConfigSystem()

at System.Configuration.ConfigurationManager.get_AppSettings()

at Telerik.Windows.Controls.ThemeResourceKey.get_ApplicationTheme()

at Telerik.Windows.Controls.StyleManager.SetDefaultStyleKey(Control control, Type controlType)  

at MS.Internal.Xaml.Runtime.ClrObjectRuntime.InitializationGuard(XamlType xamlType, Object obj, Boolean begin)

Inner Exception:

----->>>>>

Exception Source: System.Configuration

Exception Message: Root element is missing (C:\Users\Administrator\AppData\Local\Harmonic,_Inc.\Harmonic.GUI.DomainManage_StrongName_ixapsog5lcwreuscruvj3lgrgpth3ywq\1.0.0.0\user.config)

Exception StackTrace:  

at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)

at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)

at System.Configuration.ClientConfigurationSystem.OnConfigRemoved(Object sender, InternalConfigEventArgs e)

Inner Exception:

----->>>>>

Exception Source: System.Xml  

Exception Message: Root element is missing.  

Exception StackTrace:

at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(String res)

at System.Xml.XmlTextReaderImpl.ParseDocumentContent()  

at System.Configuration.XmlUtil..ctor(Stream stream, String name, Boolean readToFirstElement, ConfigurationSchemaErrors schemaErrors)  

at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()  

 

We replaced the config file and it worked.

But,

Could you please let us know, what could cause this issue, and how can we prevent this.

 

Thanks,

Piyush

Milena
Telerik team
 answered on 06 Jun 2016
16 answers
1.3K+ views
Hi,

I'm having some trouble using bindings in my column headers. After reading this post: http://www.telerik.com/community/forums/wpf/gridview/binding-the-header-property-of-a-gridviewcolumn.aspx it seems like you have to have the property you are binding to available when the column is initialised, otherwise it will not get updated. 

I am wanting to bind to a property of the data context of a parent of the control that hosts the RadGridView. The DataContext hasn't been set by the time the column is initialized. Is there a way around this? I had a few ideas:

- Is there some event I can handle which is called before the columns are initialized, but after we have access to the UserControl's parent and hence its DataContext.
- Is there a way to reset the columns and hence the bindings?

I'm trying an MVVM approach, but I can't seem to fit in the ModelView approach with the column headers as I can't bind. The only way is to have the DataContext set in the control constructor, but that's fairly limited and I would rather avoid it.

Any suggestions / tips would be much appreciated!
Maya
Telerik team
 answered on 06 Jun 2016
0 answers
130 views
We have big WPF application with multiple screen. Each screen have multiple textboxes.

We have used MVVM pattern so textboxes are bound to VM using like:
{Binding Name,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}

In Most of the textboxes BUT not all, we want to set Delay Property to some value say 500 like:

{Binding Name,Delay=500,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}

Rather than setting this on each textbox xaml line is there some shorter way to handle this?

something like Style.xaml etc?
These changes are applicable for most of the textboxes but not all....
dotnetavalanche
Top achievements
Rank 1
 asked on 04 Jun 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?