Telerik Forums
UI for WPF Forum
2 answers
851 views

Hi,

I have a grid with 4 columns. On selecting/changing value for 3rd column(i.e.: NewFamily) I want to programmatically set some value for the combobox in 4th column (selected value as well as list)

Here is the xaml:
        <telerik:RadGridView Grid.Row="0"  x:Name="PartFamilyGrid" AutoGenerateColumns="False" 
                             ColumnWidth="*" MinHeight="150"
                             RowIndicatorVisibility="Collapsed" SelectionChanged="PartFamilyGrid_SelectionChanged"
                             >  
                <telerik1:StyleManager.Theme>
                    <telerik1:VisualStudio2013Theme/>
                </telerik1:StyleManager.Theme>
                <telerik:RadGridView.Columns>
                
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Family}"    IsReadOnly="True" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Part}"      IsReadOnly="True" />

                <telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <telerik:RadComboBox ItemsSource ="{Binding NewFamily}" SelectionChanged="NewFamilySelected" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                    <telerik:GridViewDataColumn.Header>New Family</telerik:GridViewDataColumn.Header>
                </telerik:GridViewDataColumn>

                <telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <telerik:RadComboBox ItemsSource ="{Binding NewPart}" SelectionChanged="NewPartSelected" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                    <telerik:GridViewDataColumn.Header>New Part</telerik:GridViewDataColumn.Header>
                </telerik:GridViewDataColumn>
                
                
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>

Items of this RadGridView are objects of this class
    public class PartFamilyGridItem : INotifyPropertyChanged
        {
        public string Family
            {
            get; set;
            }
        public string Part
            {
            get; set;
            }
        public List<string> NewFamily
            {
            get; set;
            }
        public List<string> NewPart
            {
            get; set;
            }

        public event PropertyChangedEventHandler PropertyChanged;
        }

In the SelectionChanged event (NewFamilySelected) for the RadComboBox in 3rd column i want to handle this task. But I am not sure how to do it.
Do I need to get the row of the RadComboBox (from 3rd col) for which value is modified, select the RadComboBox from 4th col and finally change the selectedValue?

 

A similar issue is handled here https://www.telerik.com/forums/change-the-cell-content-at-runtime#MtiwER8x9USdCWTtLyu5_A

but I am not getting how to handle it for combobox

maria
Top achievements
Rank 1
 answered on 25 Oct 2018
7 answers
794 views
Hi,
I just started to investigate the gridView control and got stuck in to a problem:
Is it possible to change a specific cell content in a grid view?
I want to with something like this:

radGridView.Rows[radGridView.SelectedRow].Cols["Col_Name"].value =   
MY_NEW_VALUE; 
maria
Top achievements
Rank 1
 answered on 25 Oct 2018
1 answer
128 views

Hello again!

I'd like to create custom class that is RadDiagramConnection and has its full functionality within RadDiagram , but with some additional data ( implementation of additional interface).

When I am creating it via inheriting from RadDiagramConnection ( as it is recommended in Telerik documentation here: https://docs.telerik.com/devtools/wpf/controls/raddiagram/howto/create-custom-connectioncap ).

But when I add it to my RadDiagram, I see nothing. As I know where my LineObject is I can click on it and see 2 ancor-points, but I can not see RadDiagramConnection itself. Picture is attached.

Would you be so kind to tell me how I can implement this thing?

This is my .cs file

public class LineObject : RadDiagramConnection
 {
      
}

This is my Xaml file:

    <telerik:RadDiagram  >
        <telerik:RadDiagramConnection StartPoint="250,250" EndPoint="150,150"
                                          SourceCapType="Arrow1Filled" TargetCapType="Arrow1Filled"
                                          SourceCapSize="20,20" TargetCapSize="20, 20"
                                          StrokeThickness="5" Background="Red"
                                          Stroke="Red"
                                          />
        <imageeditor:LineObject StartPoint="150,250" EndPoint="250,150"
                                          SourceCapType="Arrow1Filled" TargetCapType="Arrow1Filled"
                                          SourceCapSize="20,20" TargetCapSize="20, 20"
                                          StrokeThickness="5" Background="Blue"
                                          Stroke="Blue" />
 
</telerik:RadDiagram>

 

Best regards,
Tatiana

Tatiana
Top achievements
Rank 1
 answered on 24 Oct 2018
5 answers
250 views

if before the fixed width  column,there is the "*" column,for example:
  there are five columns,column0=150;column1=*;column2=250;column3=150;column4=250;
It is difficult resize the column width,I search the feedback information,and found there is the feedback in 2016,
but don't disposal ,so i got the old source code,and find some question code :
   in the GridViewColumnCollectionInternal.cs file,the function RecalculateNonStarColumnWidthsOnPositiveResize()
and RecalculateNonStarColumnWidthsOnNegativeResize() have bug.
    the first: adjust the RecalculateNonStarColumnWidthsOnPositiveResize()
change frome
column.SetWidthInternal(new GridViewLength(width.Value, GridViewLengthUnitType.Pixel, width.DesiredValue, width.DisplayValue - columnExcessWidth));
to
  column.SetWidthInternal(new GridViewLength(width.DisplayValue - columnExcessWidth));

then positive resize is OK!
In addition,the other method:
//PositiveResize Non * column
private double RecalculateNonStarColumnWidthsOnPositiveResize(
   double change,
   int index,
   bool retainAuto)
  {
   if (DoubleUtil.GreaterThan(change, 0.0))
   {
                #region calculate the resize total width
                double canAdjustWidth = 0;double totalWidth = 0;
                for (int i = this.Count - 1;  i > index; i--)
                {
                    var column = this.ColumnFromDisplayIndex(i);
                    if (!IsColumnResizable(column))
                    {
                        continue;
                    }
                    var width = column.Width;
                    var minWidth = column.MinWidth;
                    if (!width.IsStar &&
                        DoubleUtil.GreaterThan(width.DisplayValue, minWidth))
                    {
                        canAdjustWidth += width.DisplayValue - minWidth;
                        totalWidth += width.DisplayValue;
                    }
                }
                #endregion
                #region resize column by scale
                double actualAdjustWidth = 0;
                if (change > canAdjustWidth) actualAdjustWidth = canAdjustWidth;
                else actualAdjustWidth = change;
                for (int i = this.Count - 1; i > index; i--)
                {
                    var column = this.ColumnFromDisplayIndex(i);
                    if (!IsColumnResizable(column))
                    {
                        continue;
                    }
                    var width = column.Width;
                    var minWidth = column.MinWidth;
                    if (!width.IsStar &&
                        DoubleUtil.GreaterThan(width.DisplayValue, minWidth))
                    {
                        double adj = width.DisplayValue* actualAdjustWidth / totalWidth;
                        column.SetWidthInternal(new GridViewLength(width.DisplayValue-adj));
                    }
                }
                #endregion
                #region adjust the current column
                if (DoubleUtil.GreaterThan(actualAdjustWidth, 0.0))
                {
                    var column = this.ColumnFromDisplayIndex(index);
                    SetColumnWidth(column, actualAdjustWidth, retainAuto);
                    change -= actualAdjustWidth;
                }
                #endregion
   }
   return change;
  }
 and second modify the NegativeResize code:
  private double RecalculateNonStarColumnWidthsOnNegativeResize(
   double change,
   int index,
   bool retainAuto)
  {
   if (DoubleUtil.GreaterThan(change, 0.0))
   {
                #region calculate the total width of the right resize column
                double canAdjustWidth = 0;
                int needAdjustCount = 0;
                int needAdjustCountStar = 0;
                bool isExistMinWidth = false;
                for (int i = index + 1;  i < this.Count; i++)
                {
                    var column = this.ColumnFromDisplayIndex(i);
                    if (!IsColumnResizable(column))
                    {
                        continue;
                    }
                    var width = column.Width;
                    //include the * column
                    if (!DoubleUtil.AreClose(width.DisplayValue, column.MaxWidth))
                    {
                        canAdjustWidth += width.DisplayValue;
                        if (!width.IsStar) //fixed column
                        {
                            needAdjustCount += 1;
                            if (DoubleUtil.GreaterThan(column.MinWidth*3, width.DisplayValue))
                            {
                                isExistMinWidth = true;
                            }
                        }
                        else
                            needAdjustCountStar += 1;
                    }
                }
                #endregion
                #region  when the fixed column width is small the  three times minvalue,or non * column
                if(!isExistMinWidth && needAdjustCountStar>0) return change;
                #endregion
                #region resize column by scale
                double actualAdjustWidth = 0;
                double totalAdjustWidth = 0;
                if (change > canAdjustWidth)
                    actualAdjustWidth = canAdjustWidth;
                else
                    actualAdjustWidth = change;
                for (int i = this.Count - 1; i > index; i--)
                {
                    var column = this.ColumnFromDisplayIndex(i);
                    if (!IsColumnResizable(column))
                    {
                        continue;
                    }
                    var width = column.Width;
                    if (!width.IsStar &&
                        !DoubleUtil.AreClose(width.DisplayValue, column.MaxWidth))
                    {
                        double adj = width.DisplayValue * actualAdjustWidth / canAdjustWidth;
                        totalAdjustWidth += adj;
                        column.SetWidthInternal(new GridViewLength(width.DisplayValue + adj));
                    }
                }
                #endregion
                #region adjust the current column
                if (DoubleUtil.GreaterThan(totalAdjustWidth, 0.0))
                {
                    var column = this.ColumnFromDisplayIndex(index);
                    SetColumnWidth(column, -totalAdjustWidth, retainAuto);
                    change -= totalAdjustWidth;
                }
                #endregion          
   }
   return change;
  }


Vladimir Stoyanov
Telerik team
 answered on 24 Oct 2018
4 answers
483 views

After editing a cell in a grid, the next row below is automatically selected. But if the grid is sorted, and the edit makes the current row to be moved, the row which is selected after the edit is the row below the new position. I would expect that the row to be selected is the one below the original location.

I've attached an image from a test application, and when comitting the active edit the row will be moved upwards (due to the sorting), and the next row to be selected is the one with IntegerValue 16. I want it to be the row with IntegerValue 32. Almost feels like a bug?

I've tried to override this by storing the selected row when the CellEditEnded-event is triggerd, and then trying to select it at SelectionChanging or SelectionChanged, but my attempts fail. 

Magnus
Top achievements
Rank 1
 answered on 24 Oct 2018
5 answers
278 views

Hi,

I'm seeing a new binding error in the Output window with 2016 R3 that was not there before:

System.Windows.Data Warning: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='Telerik.Windows.Controls.RadRibbonView', AncestorLevel='1''. BindingExpression:Path=IsHostedInRibbonWindow; DataItem=null; target element is 'WindowTitle' (Name='WindowTitle'); target property is 'NoTarget' (type 'Object')

 

This is coming from the new MultiDataTrigger condition added to the WindowTitleStyle. It's also coming from the WindowTitle that exists in the RadRibbonWindowStyle control template, which does not have a RadRibbonView ancestor, as opposed to the one in the RadRibbonViewTemplate.

Dinko | Tech Support Engineer
Telerik team
 answered on 24 Oct 2018
1 answer
105 views

Add a table In a word, in a tableCell,the value changes depending the values of some other TableCells ,need to add a calculation formula, see the attached file"word"

But ,when changed the word to XAML, it shows "Not supported field expression!", see the attached file "RadRichTextBox"

How can I solve this ? or any other way?

Tanya
Telerik team
 answered on 23 Oct 2018
3 answers
124 views

Hi,

it is possible to prevent user from chaning merge fields content using RadRichTextBox. I know this changes are saving or affects document, but it looks not good when user can change {MERGEFIELD NAME} to something like {MERREAF52FF AAME} or anything else. Is there any flag for this? Or should I implement my own function? How to check if current caret position is inside merge field?

 

Thanks

Jakub
Top achievements
Rank 1
Iron
 answered on 23 Oct 2018
1 answer
323 views

I use RadTreeView with Custom style and HeirarchicalTemplate. I work with IsSelected property via twoway binding from viewmodel. While I switch manually or programmatically by elements of the same type AutoScrollToSelectedItem works correctly. As soon as I switch to an item of a different viewmodel type I get a scroll to the middle of the tree, the selected item is not visible on the screen. When opening the tree for the first time without the selected elements, I also have a scroll in the middle, although I expect to see the beginning of the list. 

            <Style x:Key="ExpanderStyle" TargetType="ToggleButton">
                <Setter Property="IsEnabled" Value="False" />
                <Setter Property="IsTabStop" Value="False" />
                <Setter Property="Cursor" Value="None"/>
                <Setter Property="Background" Value="Transparent"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Grid x:Name="Button" Margin="0,4,0,0" HorizontalAlignment="Right"
                                  VerticalAlignment="Top" Width="16" Height="16">
                                <Rectangle Stroke="Transparent" HorizontalAlignment="Stretch"
                                           VerticalAlignment="Stretch" Width="Auto" Height="Auto"
                                           RadiusX="3" RadiusY="3" Fill="Transparent">
                                </Rectangle>
                                <Rectangle x:Name="CollapsedVisual" HorizontalAlignment="Left"
                                           VerticalAlignment="Top" Width="2" Height="8" RadiusX="0"
                                           RadiusY="0" Fill="Transparent" Margin="7,4,0,0" />
                                <Rectangle RadiusX="0" RadiusY="0" Fill="Transparent"
                                           HorizontalAlignment="Left" Margin="4,7,0,0"
                                           VerticalAlignment="Top" Width="8" Height="2" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="TreeItemStyle" TargetType="{x:Type telerik:RadTreeViewItem}" BasedOn="{StaticResource RadTreeViewItemStyle}">
                <Setter Property="IsExpanded" Value="True"/>
                <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
                <Setter Property="HorizontalAlignment" Value="Stretch"/>
                <Setter Property="ExpanderStyle" Value="{StaticResource ExpanderStyle}"/>
                <Setter Property="FocusVisualStyle">
                    <Setter.Value>
                        <Style>
                            <Setter Property="Control.Template">
                                <Setter.Value>
                                    <ControlTemplate>
                                        <Rectangle Margin="0" Stroke="Transparent" StrokeThickness="0"/>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="HorizontalContentAlignment" Value="Left"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="Padding" Value="1,0,5,0"/>
                <Setter Property="IsDropAllowed" Value="True"/>
                <Setter Property="IsEnabled" Value="True"/>
                <Setter Property="MinHeight" Value="24"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type telerik:RadTreeViewItem}">
                            <Grid x:Name="RootElement">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Grid x:Name="HeaderRow" Background="Transparent" MinHeight="{TemplateBinding MinHeight}" SnapsToDevicePixels="True">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                        <ColumnDefinition Width="10"/>
                                    </Grid.ColumnDefinitions>
                                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.ColumnSpan="6" Grid.Column="2" CornerRadius="2"/>

                                    <Border x:Name="MouseOverVisual" BorderBrush="WhiteSmoke" BorderThickness="1" Background="Transparent"
        Grid.ColumnSpan="4" Grid.Column="2" CornerRadius="1" Opacity="0"/>

                                    <Border x:Name="SelectionUnfocusedVisual" BorderBrush="CornflowerBlue" BorderThickness="1" Background="Transparent"
        Grid.ColumnSpan="4" Grid.Column="2" CornerRadius="1" Visibility="Collapsed" >
                                    </Border>

                                    <Border x:Name="SelectionVisual" BorderBrush="CornflowerBlue" BorderThickness="1" Background="Transparent"
                                        Grid.ColumnSpan="4" Grid.Column="2" CornerRadius="1" Visibility="Collapsed">
                                    </Border>

                                    <StackPanel Grid.Column="0" x:Name="IndentContainer" Orientation="Horizontal">
                                        <Rectangle x:Name="IndentFirstVerticalLine" Stroke="#FFCCCCCC" Visibility="Collapsed" VerticalAlignment="Top" Width="1"/>
                                    </StackPanel>

                                    <Grid x:Name="ListRootContainer" Grid.Column="1" HorizontalAlignment="Center">
<!--                                        <Rectangle x:Name="HorizontalLine" HorizontalAlignment="Right" Height="1" Stroke="#FFCCCCCC" VerticalAlignment="Center"/>
                                        <Rectangle x:Name="VerticalLine" HorizontalAlignment="Center" Stroke="#FFCCCCCC" VerticalAlignment="Top" Width="1"/>
                                        <ToggleButton x:Name="Expander" Background="{TemplateBinding Background}" IsTabStop="False"/>
-->
                                        <Grid x:Name="LoadingVisual" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed" VerticalAlignment="Center">
                                            <!--                                        <Rectangle x:Name="HorizontalLine" HorizontalAlignment="Right" Height="1" Stroke="#FFCCCCCC" VerticalAlignment="Center"/>
                                            <Grid.RenderTransform>
                                                <TransformGroup>
                                                    <RotateTransform Angle="0" CenterY="0.5" CenterX="0.5"/>
                                                </TransformGroup>
                                            </Grid.RenderTransform>
                                            <Path Data="M1,0A1,1,90,1,1,0,-1" Height="10" StrokeStartLineCap="Round" Stretch="Fill" Stroke="{TemplateBinding Foreground}" StrokeThickness="1" Width="10"/>
                                            <Path Data="M0,-1.1L0.1,-1 0,-0.9" Fill="{TemplateBinding Foreground}" HorizontalAlignment="Left" Height="4" Margin="5,-1.5,0,0" Stretch="Fill" StrokeThickness="1" VerticalAlignment="Top" Width="4"/>
                                            -->

                                        </Grid>
                                    </Grid>
                                    <CheckBox x:Name="CheckBoxElement" Grid.Column="2" IsTabStop="False" Margin="5,0,0,0" Visibility="Collapsed" VerticalAlignment="Center">
                                        <telerik:StyleManager.Theme>
                                            <telerik:Expression_DarkTheme/>
                                        </telerik:StyleManager.Theme>
                                    </CheckBox>
                                    <RadioButton x:Name="RadioButtonElement" Grid.Column="2" IsTabStop="False" Margin="5,0,0,0" Visibility="Collapsed" VerticalAlignment="Center">
                                        <telerik:StyleManager.Theme>
                                            <telerik:Expression_DarkTheme/>
                                        </telerik:StyleManager.Theme>
                                    </RadioButton>
                                    <Image x:Name="Image" Grid.Column="3" HorizontalAlignment="Center" MaxWidth="16" MaxHeight="16" Margin="2" VerticalAlignment="Center"/>

                                    <Rectangle x:Name="FocusVisual" Grid.ColumnSpan="4" Grid.Column="2" IsHitTestVisible="False" 
           RadiusY="3" RadiusX="3" Stroke="Black" StrokeThickness="1"
           StrokeDashArray="1 2" Visibility="Collapsed"/>

                                    <Grid Grid.Column="4" Grid.ColumnSpan="2">
                                        <ContentPresenter x:Name="Header" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                        <ContentPresenter x:Name="EditHeaderElement" ContentTemplate="{TemplateBinding HeaderEditTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                    </Grid>
                                </Grid>
                                <ItemsPresenter x:Name="ItemsHost" Grid.Row="1" Visibility="Collapsed"/>
                            </Grid>

                            <ControlTemplate.Triggers>
                                <Trigger Property="IsInEditMode" Value="True">
                                    <Setter Property="Visibility" TargetName="Header" Value="Collapsed"/>
                                    <Setter Property="Visibility" TargetName="EditHeaderElement" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter Property="Visibility" TargetName="SelectionVisual" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="IsFocused" Value="True">
                                    <Setter Property="Visibility" TargetName="FocusVisual" Value="Visible"/>
                                </Trigger>
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="IsSelected" Value="True"/>
                                        <Condition Property="IsSelectionActive" Value="False"/>
                                    </MultiTrigger.Conditions>
                                    <Setter Property="Opacity" TargetName="SelectionVisual" Value="0"/>
                                    <Setter Property="Visibility" TargetName="SelectionUnfocusedVisual" Value="Visible"/>
                                </MultiTrigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Opacity" TargetName="Header" Value="0.5"/>
                                </Trigger>
                                <Trigger Property="IsExpanded" Value="True">
                                    <Setter Property="Visibility" TargetName="ItemsHost" Value="Visible"/>
                                </Trigger>
                                <Trigger Property="IsLoadingOnDemand" Value="True">
                                    <Trigger.EnterActions>
                                        <BeginStoryboard x:Name="LoadingVisualTransform">
                                            <Storyboard>
                                                <DoubleAnimation Duration="0:0:1" From="0" RepeatBehavior="Forever" To="359" Storyboard.TargetProperty="Angle" Storyboard.TargetName="LoadingVisualAngleTransform"/>
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </Trigger.EnterActions>
                                    <Trigger.ExitActions>
                                        <StopStoryboard BeginStoryboardName="LoadingVisualTransform"/>
                                    </Trigger.ExitActions>
                                    <Setter Property="Visibility" TargetName="LoadingVisual" Value="Visible"/>
                                    <!--<Setter Property="Visibility" TargetName="Expander" Value="Collapsed"/>-->
                                </Trigger>
                                <Trigger Property="IsDragOver" Value="True">
                                    <Setter Property="Opacity" TargetName="MouseOverVisual" Value="1"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" SourceName="HeaderRow" Value="True">
                                    <Setter Property="Opacity" TargetName="MouseOverVisual" Value="1"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <telerik:TreeViewPanel IsItemsHost="True" IsVisualCacheEnabled="False" VerticalAlignment="Bottom"/>
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

 

        <telerik:RadTreeView Name="treeViewOperationItems" ItemsSource="{Binding OperationCollection, Mode=TwoWay}" Background="White"
                             IsLineEnabled="False" Grid.Row="1" Grid.RowSpan="2" Margin="5" ItemContainerStyle="{StaticResource TreeItemStyle}"
                             ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                             AutoScrollToSelectedItem="True">

            <telerik:RadTreeView.Resources>
                <HierarchicalDataTemplate DataType="{x:Type viewModels:OperationDefVM}" ItemsSource="{Binding Items}">
                    <StackPanel Orientation="Vertical" Margin="10" FocusManager.FocusedElement="{Binding ElementName=textBox}" >
                        <TextBox x:Name="textBox" Text="{Binding Path=Data.Def.UniqueId}" 
                                 helpers:FocusExtension.IsFocused="{Binding IsSelected, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                                 MinWidth="100" Style="{StaticResource TreeTextBoxStyle}"/>
                        <extendEditor:ExtendedEditor Text="{Binding Path=Data.Def.UniqueId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                     x:Name="edit" Height="40"  Width="400" FontSize="14"/>
                    </StackPanel>
                </HierarchicalDataTemplate>

                <HierarchicalDataTemplate DataType="{x:Type viewModels:IndexedStepVM}" ItemsSource="{Binding Items}">
                    <StackPanel Orientation="Horizontal" Margin="10">
                        <Grid Width="30" VerticalAlignment="Center">
                            <TextBlock Text="{Binding Crew}" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                        </Grid>
                        <TextBlock Text="{Binding Path=Index, StringFormat='{}{0}. ' }" 
                                   Background="Transparent" Foreground="{StaticResource EditorTextColor}" 
                                   VerticalAlignment="Center"/>
                        <telerik:RadWatermarkTextBox x:Name="textBox"
                                 Text="{Binding Path=Title}"
                                 helpers:FocusExtension.IsFocused="{Binding IsSelected, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                                 TextWrapping="Wrap" AcceptsReturn="True"
                                 WatermarkContent="{Binding Watermark}"
                                 BorderThickness="0" BorderBrush="Transparent" Foreground="{StaticResource EditorTextColor}"
                                 Background="Transparent">
                            <telerik:RadWatermarkTextBox.InputBindings>
                                <KeyBinding Command="{Binding AddItemAfterMeCommand}" Key="Return" Modifiers="Control"/>
                                <KeyBinding Command="{Binding SelfKillCommand}" Key="Delete"  Modifiers="Control"/>
                            </telerik:RadWatermarkTextBox.InputBindings>
                        </telerik:RadWatermarkTextBox>
                    </StackPanel>
                </HierarchicalDataTemplate>

     </telerik:RadTreeView.Resources>
        </telerik:RadTreeView>



Dinko | Tech Support Engineer
Telerik team
 answered on 23 Oct 2018
15 answers
638 views

Hi,

 

I'm populating RadDiagram by defining a GraphSource. I have several different types of nodes with unique shapes. How do I link the node with its graphical presentation. The example in documentation uses ConnectionStyle and ShapeStyle attributes of telerik:RadDiagram, However in my case I have several ShapeStyles. 

 

<telerik:RadDiagram x:Name="diagram"
                       ConnectionStyle="{StaticResource pascalEdgeStyle}"
                       ShapeStyle="{StaticResource pascalNodeStyle}" />  <!-- How to change this for multiple node styles? -->
Sami
Top achievements
Rank 1
 answered on 22 Oct 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?