Telerik Forums
UI for WPF Forum
1 answer
119 views
I have multiple RadComboBox Inside a
RadGridView. When I open the application, the data is loaded into all
the ComboBox. However, when I get out of the view, the first
ComboBox's itemselected is set to null by itself. If I go back to that
view again, I see the first ComboBox with Null. If I exit again out
of the view, the second ComboBox's itemselected is set to
null. I put an event handler for selectionindexchanged, and it
shows that when I exit the view, selectionindexchanged is triggered and at
the end one of the value that is pulled from a datasource is set to
null. I need to stop the ComboBox from changing the value to null by
itself.  

Nasko
Telerik team
 answered on 20 May 2015
1 answer
472 views

Hi, I have RadTreeView where the item can be added on various levels of the tree by clicking the button on the parent node. Sometimes when this parent has more children, the newly added item is not shown (the user needs to manually scroll to it, because it is below the other items). I need to automatically show the newly added item. I've tried everything but I couldn't get this to work. With the virtualization of the tree switched off I think that this code should work:

RadTreeViewItem seletedItem = treeView.ContainerFromItemRecursive(treeView.SelectedItem);
seletedItem.BringIntoView();

 But it does not (nothing happens). Also I tried to call:

treeView.BringItemIntoView(seletedItem);

and 

treeView.BringItemIntoView(reeView.SelectedItem);

with no success. Currently i am trying to use path (although I'm not sure this would work since I'm using ItemsTemplate for the items in the tree. Again with no success. Please tell me how to achieve the desired functionality - It does not need to be bound to selected item, I just need to be able to scroll automatically to (bring into view) to the desired item from the tree. Currently the code and XAML are the following:

   <HierarchicalDataTemplate x:Key="EquipmentTemplate" DataType="model:IComponentTreeItem"  ItemsSource="{Binding Children}">
       <Grid>
           <Grid.ColumnDefinitions>
               <ColumnDefinition Width="*"/>
               <ColumnDefinition Width="Auto"/>
           </Grid.ColumnDefinitions>
 
           <TextBox HorizontalAlignment="Stretch" PreviewMouseDown="UIElement_OnPreviewMouseDown" IsReadOnly="{Binding ViewSettings.IsReadOnly}" Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"/>
 
           <StackPanel Orientation="Horizontal" Grid.Column="1" >
               <telerik:RadButton HorizontalAlignment="Right" Content="+" Width="20" Height="20" Foreground="{StaticResource scbComponent}" Click="AddButton_OnClick"
                                      Visibility="{Binding Converter={StaticResource EquipmentToVisibilityConverter}, ConverterParameter=add}"
                                      Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.AddEquipmentCommand}" CommandParameter="{Binding}" ToolTip="New Component" />
                
               <telerik:RadButton HorizontalAlignment="Right"  Content="X" Width="20" Height="20" Foreground="Red"
                                  Visibility="{Binding Converter={StaticResource EquipmentToVisibilityConverter}, ConverterParameter=delete}"
                                  Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.DeleteCommand}" CommandParameter="{Binding}"  />
                
 
           </StackPanel>
 
       </Grid>
 
       <HierarchicalDataTemplate.ItemContainerStyle>
           <Style TargetType="telerik:RadTreeViewItem">
 
               <Setter Property="HorizontalContentAlignment" Value="Stretch"  />
               <Setter Property="IsExpanded"
                          Value="{Binding IsExpanded, Mode=TwoWay}" />
           </Style>
       </HierarchicalDataTemplate.ItemContainerStyle>
   </HierarchicalDataTemplate>
 
 
 
<telerik:RadTreeView Grid.Row="0" Grid.Column="2"
                   IsVirtualizing="False"
                   IsLineEnabled="True"
                   MinWidth="300"
                   x:Name="ComponentsTree"
                   HorizontalContentAlignment="Stretch"
                   HorizontalAlignment="Stretch"
                   ItemTemplate="{StaticResource EquipmentTemplate}"
                   IsEditable="True"
                   AutoScrollToSelectedItem="True"
                   SelectedItem="{Binding SelectedTreeEquipment, Mode=TwoWay}"
                   ItemsSource="{Binding Equipments}">
                   
               </telerik:RadTreeView>

 

 

private void AddButton_OnClick(object sender, RoutedEventArgs e)
     {
         var frameworkElement = sender as FrameworkElement;
         if (frameworkElement != null)
         {
             var treeItem = frameworkElement.DataContext as IComponentTreeItem;
             if (treeItem == null) return;
             var tree = frameworkElement.GetVisualParent<RadTreeView>();
             tree.BringIntoViewMode = BringIntoViewMode.HeaderAndItems;
             tree.AutoScrollToSelectedItem = false;
             var itemToScroll = (treeItem.Children != null && treeItem.Children.Any()) ?  treeItem.Children.Last() :  treeItem;
             var path = GetPathFromIComponentTreeItem(itemToScroll);
             tree.SelectItemByPath(path);
             tree.BringPathIntoView(path);   
              
         }
     }
 
     public string GetPathFromIComponentTreeItem(IComponentTreeItem item)
     {
         string path = item.Name;
         IComponentTreeItem nextParent = item.ParentItem;
         while (nextParent != null)
         {
             path = String.Concat(nextParent.Name, @"\", path);
             nextParent = nextParent.ParentItem;
         }
         return path;
     }

 

 

public interface IComponentTreeItem
   {
       string Name { get; set; }
       short Order { get; set; }
       TreeItemType Type { get; }
       bool IsExpanded { get; set; }
       ObservableCollection<IComponentTreeItem> Children { get; set; }
       IComponentTreeItem ParentItem { get; set; }
       TreeItemViewSettings ViewSettings { get; set; }
 
   }
 
public class TreeItemViewSettings
   {
       public bool CanAddChildren { get; set; }
 
       public bool CanDelete { get; set; }
 
       public bool CanReorder { get; set; }
 
       public bool IsReadOnly { get; set; }
    
   }

 

Thank you in advance!


Martin Ivanov
Telerik team
 answered on 20 May 2015
1 answer
124 views

Hallo,

i'd like to implement funcionality this: i have diagram wiht some shapes, connections groups etc. I ' d like to for example ... after double click on group open just this group in new diagram. Could you be so kind and write me some hints how to make or how to manage multiple diagrams saved in some for example list or array?

 

thank you

Best regards 

Jakub

Kiril Vandov
Telerik team
 answered on 20 May 2015
7 answers
104 views
Hi,

I have a diagram where i group some shapes together. At some point, I want the user to be able to do a Layout of what they have drawn, but I want grouped shapes to stay together how they are grouped.

The default Layout method rearranges shapes within a group, and in my case, that ens up being really messy. How can I implement a Layout method that honours the grouped shapes as one item?

/HH
Petar Mladenov
Telerik team
 answered on 20 May 2015
2 answers
189 views
hello
im developing health care system using licensed telerik wpf compoents
for hospital in south korea.

i already know that we can use MergedCellsDirection property and IsCellMergingEnabled property when merge cells in radgridview

i just want to know Whether there is a way to merge cells physically
when edit merged cell area
not using style as MergedCellsDirection property.
as attached captured image file(only 1 textboxaea...)

I have to convince our customers why can not merge cells physically
don't be like farpoint grid for winform.

I'm sure gonna help you advice for me and our customer.
thanks ...
EDDY
Top achievements
Rank 1
 answered on 20 May 2015
5 answers
447 views

Hello,

I use richtextbox with XamlDataProvider, and I would like to change default font size (set it to 8) and line spacing (set it to 1) for bullets and numbered lists. It means, when the control is loaded and a user creates one of the lists, default font size and line spacing should be 8 and 1 (or other values I set in the code)

I could do such functionality for simple text, but couldn't for lists. In the attached file you can find described issue from a user point of view (if he or she started writing text without any settings changes)

Below you can also find my code.

Hope for your help.

Thanks.

XAML:

... 
 
<telerik:XamlDataProvider x:Name="XamlDataProvider"  Xaml="{Binding ElementName=RichTextBoxControl, Path=Text, ode=TwoWay}" RichTextBox="{Binding ElementName=Editor}" SetupDocument="XamlDataProvider_OnSetupDocument"/>
 
<telerik:RadRichTextBox Name="Editor" Grid.Row="1" PreviewMouseDoubleClick="Editor_OnPreviewMouseDoubleClick" IsSpellCheckingEnabled="False" DocumentInheritsDefaultStyleSettings="True" FontSize="12"/>

 

...

C#:

... 
 
private void XamlDataProvider_OnSetupDocument(object sender, SetupDocumentEventArgs e)
{
    e.Document.ParagraphDefaultSpacingAfter = 0;
    e.Document.LineSpacingType = LineSpacingType.Auto;
    e.Document.LineSpacing = 1;
}

 

...

Grigory
Top achievements
Rank 2
 answered on 19 May 2015
4 answers
100 views

I recently upgraded my telerik DLL's to UI for WPF Q1 2015 SP1, After upgrading i am getting error with scrollviewerstyle.

I am overriding scrollviewer style <Style TargetType="{x:Type ScrollViewer}" BasedOn="{StaticResource ScrollViewerStyle}"> .... </style> and this was working fine with older version of telerik, I had 2014 version.

I am using implicit styles so i have Syste.Windows.xaml file in my project and i am loading it in my app.xaml.cs

<ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/ntierHealth;component/Resources/Themes/System.Windows.xaml"/>
                <ResourceDictionary Source="/ntierHealth;component/Resources/Themes/Telerik.Windows.Controls.xaml"/> .....

If i use the old version of system.windows.xaml or if i remove my style everything works but not with the latest version. I am getting StaticResourceHolder threw an exception. I have attached screen shot  of the error.

Thanks

vikas

 

 

Vanya Pavlova
Telerik team
 answered on 19 May 2015
1 answer
124 views

I have some columns in datagridview which can be edited. When i select a row by clicking anywhere on the row and then single click on a cell to edit, the row selection goes away.But when we double click on the cell the cell becomes editable. I also have  a checkbox to select a row. Currently selection mode property of the grid is multiple.    Is there a way by which single clicking on a cell will not result in deselection of the  row?

 

Stefan
Telerik team
 answered on 19 May 2015
1 answer
87 views

Hello,

I have a column with a SumAggregateFunction.

I want to style the footer, if the sum is < 0, the foreground must be Red, if sum > 0, foreground must be Green.

I have not found how to do... Please help

Dimitrina
Telerik team
 answered on 19 May 2015
1 answer
128 views

I tried SelectionUnit="FullRow" to select a row with default highlights, and in RadGridView.RowStyle setting Trigger IsSelected with Value="True" to change a selection for all row with bacground colour. Nothing works properly (highlights only a cell), only IsMouseOver works that I expected.

 

<telerik:RadGridView x:Name=... SelectionUnit="FullRow" 

... >

                    <telerik:RadGridView.RowStyle>
                        <Style TargetType="{x:Type telerik:GridViewRow}">
                            <Style.Triggers>
                                <Trigger Property="IsSelected" Value="true" >
                                    <Setter Property="Background" Value="#CF7600"/>
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </telerik:RadGridView.RowStyle>

 

Do you have any simple examples for solve this problem? 

First image: http://docs.telerik.com/devtools/wpf/controls/radgridview/selection/basics.html

but it's doesn't work.

Stefan
Telerik team
 answered on 19 May 2015
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?