Telerik Forums
UI for WPF Forum
1 answer
336 views

Hi, 

I have strange behaviour which is different from the current demo.

I have a bound grid with SelectionMode=Extended.  I can Ctrl-Click to select a 'n' number of rows and the select as expected.  But if I then single left click on anyone of those selected rows, I would expect that row to become the only selected row.  Now that is what happens in the demo, but for me, all my selected rows remain selected.

I was using version 'WPF Q2 2013 SP 1', but then tried a newer version that I had access to via our account 'UI for WPF Q1 2015', but the problem remains.

My grid markup is as follows - any thoughts very much appreciated.  I have looked and tried numerous things after reading similar style threads here, but nothing is helping.

<telerikGridView:RadGridView                                                 
                            HorizontalAlignment="Stretch" 
                            Margin="3"
                            Grid.RowSpan=" 2"
                            MinHeight ="50"
                            Height="Auto"
                            x:Name="radStandardGrid"
                            VerticalAlignment="Stretch"
                            AutoGenerateColumns="False" 
                            ShowGroupPanel="False"
                            CanUserInsertRows="False"
                            CanUserDeleteRows="False"
                            CanUserReorderColumns="False"
                            HorizontalContentAlignment="Stretch"
                            ScrollViewer.IsDeferredScrollingEnabled="True"
                            ScrollViewer.VerticalScrollBarVisibility="Auto"
                            ScrollViewer.HorizontalScrollBarVisibility="Auto"
                            VirtualizingStackPanel.IsVirtualizing="True"
                            VirtualizingStackPanel.VirtualizationMode="Recycling"
                            RowIndicatorVisibility="Collapsed"
                            CanUserFreezeColumns="False"
                            AreRowDetailsFrozen="False"
                            IsEnabled="True"
                            IsReadOnly="True"
                            ItemsSource="{Binding VirtualGridView}"
                            Sorting="radStandardGrid_Sorting"
                            SelectionChanging="radStandardGrid_SelectionChanging"
                            ScrollMode="Deferred"
                            RowActivated="radStandardGrid_RowActivated"
                            Keyboard.PreviewKeyDown="StandardGrid_PreviewKeyDown"
                            Keyboard.PreviewKeyUp="StandardGrid_PreviewKeyUp"
                            MouseRightButtonUp="StandardGrid_MouseRightButtonUp"
                            SelectionMode="Extended"
                            RowStyle="{StaticResource UnfocusedGridViewStyle}">

Mark
Top achievements
Rank 1
 answered on 12 Apr 2017
4 answers
212 views

Good afternoon. How can I set the Binding Path for primitives:BackgroundGrid.LineStroke? Now I'm trying to do so

primitives:BackgroundGrid.LineStroke="{Binding Path=SelectedColorGrid, ElementName=GridColorEditor, Mode=TwoWay, Converter={StaticResource customColorToBrushConverter}}"

it's not working. For example, it works as

primitives:BackgroundGrid.CellSize="{Binding Path=CellSize , Mode=TwoWay}"   

My XAML code:

   <StackPanel Orientation="Horizontal" Margin="10 0">
                                                <CheckBox x:Name="ShowGridCheckBox" Content="{x:Static res:Resources.ShowGrid}" Width="110"
Margin="0 0 20 0" IsChecked="{Binding Path=GridEnable, Mode=TwoWay}"
Foreground="{telerik:Windows8Resource ResourceKey=StrongBrush}"
VerticalAlignment="Center" />
                                                <telerik:RadDropDownButton Width="80" DropDownWidth="210"
HorizontalContentAlignment="Right" FlowDirection="RightToLeft"
DropDownButtonPosition="Left">
                                                    <Border Width="12" Height="12" Margin="2 3"
Background="{Binding SelectedColorGrid ,Mode=TwoWay, ElementName=GridColorEditor, Converter={StaticResource customColorToBrushConverter}}"
BorderBrush="#d6d4d4" BorderThickness="1" />
                                                    <telerik:RadDropDownButton.DropDownContent>
                                                        <telerik:RadColorEditor x:Name="GridColorEditor" FlowDirection="LeftToRight"
ActiveSections="SaturationValuePad, HuePad" HistoryCapacity="8"
SelectedColor="{Binding SelectedColorGrid ,Mode=TwoWay, Converter={StaticResource customColorToBrushConverter}}" />
                                                    </telerik:RadDropDownButton.DropDownContent>
                                                </telerik:RadDropDownButton>
                                            </StackPanel>

 

<StackPanel Orientation="Horizontal" Margin="10 12 10 0">
                                                <TextBlock Text="{x:Static res:Resources.Cell}" Width="90" Margin="20 0" VerticalAlignment="Center" />
                                                <TextBox Width="80" Text="{Binding CellSize, Mode=TwoWay}" />
                                            </StackPanel>

 

where SelectedColorGrid and CellSize  its:

  public Size CellSize

        {
            get
            {
                Globals.Project.CellSize = cellSize;
                if (cellSize == new Size(0, 0))
                { cellSize = new Size(20, 20); }
                return this.cellSize;
            }
            set
            {
                if ((this.cellSize != value)&&(value!= new Size(0, 0)))
                {
                    this.cellSize = value;
                    this.OnPropertyChanged("CellSize");
                }
                else if ((cellSize == new Size(0, 0))|| (value == new Size(0, 0)))
                { cellSize = new Size(20, 20); }
            }
        }

        public Color SelectedColorGrid
        {
            get
            {
                Globals.Project.SelectedColorGrid = _selectedColorGrid;
                return this._selectedColorGrid;
            }
            set
            {
                if (this._selectedColorGrid != value)
                {
                    this._selectedColorGrid = value;
                    this.OnPropertyChanged("SelectedColorGrid");
                }
            }
        }

Svyatoslav
Top achievements
Rank 1
 answered on 12 Apr 2017
0 answers
117 views

Hi,

Two rows in the attached file have error. If I use mouse select them, the color

of the row will not change. I set ValidatesOnDataErrors="InViewMode".

Thanks.

 

Gaoming
Top achievements
Rank 1
 asked on 10 Apr 2017
1 answer
521 views

Hello,

I need to get selected TreeView Node name and bind it to ViewModel property.

I used the following behavior to get SelectedItem from WPF TreeView, but when changed to RadTreeView the SelectedItemChanged  is not recognized. 

Is there any example on ho to get SelectedItem using WPF MVVM ?

 public class TreeViewSelectedItemBlendBehavior : Behavior<RadTreeView>
    {
        //dependency property
        public static readonly DependencyProperty SelectedItemProperty =
            DependencyProperty.Register("SelectedItem", typeof(object),
            typeof(TreeViewSelectedItemBlendBehavior),
            new FrameworkPropertyMetadata(null) { BindsTwoWayByDefault = true });

        //property wrapper
        public object SelectedItem
        {
            get { return (object)GetValue(SelectedItemProperty); }
            set { SetValue(SelectedItemProperty, value); }
        }

        protected override void OnAttached()
        {
            base.OnAttached();
            this.AssociatedObject.SelectedItemChanged += OnTreeViewSelectedItemChanged;
        }

        protected override void OnDetaching()
        {
            base.OnDetaching();
            if (this.AssociatedObject != null)
                this.AssociatedObject.SelectedItemChanged -= OnTreeViewSelectedItemChanged;
        }

        private void OnTreeViewSelectedItemChanged(object sender,
            RoutedPropertyChangedEventArgs<object> e)
        {
            this.SelectedItem = e.NewValue;
        }
    }

 

Thank you,

Vadim

Martin Ivanov
Telerik team
 answered on 10 Apr 2017
1 answer
122 views

there is a difference between window view at run time and when it is showed in the XAML code.how can fix it?

I have used RibbonWindow and in the XAML file.

two pictured is attached

Dinko | Tech Support Engineer
Telerik team
 answered on 10 Apr 2017
0 answers
423 views

Hello, i'm trying to center my text vertically in my autocompletebox but te text stays centered on top. Why is this ?

this is my complete code:

<Style x:Key="RadAutoCompleteBoxStyle" TargetType="{x:Type telerik:RadAutoCompleteBox}">
 
            <Setter Property="IsTabStop" Value="False"/>
 
            <Setter Property="TextBoxStyle">
 
                <Setter.Value>
 
                    <Style TargetType="{x:Type telerik:RadWatermarkTextBox}">
 
                        <Setter Property="BorderThickness" Value="0"/>
 
                        <Setter Property="Margin" Value="3,3,0,0"/>
 
                        <Setter Property="Padding" Value="0"/>
 
                        <Setter Property="BorderBrush" Value="Transparent"/>
 
                        <Setter Property="Background" Value="Transparent"/>
 
                        <Setter Property="Template">
 
                            <Setter.Value>
 
                                <ControlTemplate TargetType="{x:Type telerik:RadWatermarkTextBox}">
 
                                    <Grid x:Name="RootElement" Cursor="IBeam">
 
                                        <VisualStateManager.VisualStateGroups>
 
                                            <VisualStateGroup x:Name="CommonStates">
 
                                                <VisualState x:Name="Normal">
 
                                                    <Storyboard>
 
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverVisual">
 
                                                            <LinearDoubleKeyFrame KeyTime="0:0:0.15" Value="0"/>
 
                                                        </DoubleAnimationUsingKeyFrames>
 
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="MouseOverVisual">
 
                                                            <DiscreteObjectKeyFrame KeyTime="0:0:0.15">
 
                                                                <DiscreteObjectKeyFrame.Value>
 
                                                                    <Visibility>Collapsed</Visibility>
 
                                                                </DiscreteObjectKeyFrame.Value>
 
                                                            </DiscreteObjectKeyFrame>
 
                                                        </ObjectAnimationUsingKeyFrames>
 
                                                    </Storyboard>
 
                                                </VisualState>
 
                                                <VisualState x:Name="MouseOver">
 
                                                    <Storyboard>
 
                                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverVisual">
 
                                                            <LinearDoubleKeyFrame KeyTime="0:0:0.115" Value="1"/>
 
                                                        </DoubleAnimationUsingKeyFrames>
 
                                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="MouseOverVisual">
 
                                                            <DiscreteObjectKeyFrame KeyTime="0">
 
                                                                <DiscreteObjectKeyFrame.Value>
 
                                                                    <Visibility>Visible</Visibility>
 
                                                                </DiscreteObjectKeyFrame.Value>
 
                                                            </DiscreteObjectKeyFrame>
 
                                                        </ObjectAnimationUsingKeyFrames>
 
                                                    </Storyboard>
 
                                                </VisualState>
 
                                                <VisualState x:Name="Disabled">
 
                                                    <Storyboard>
 
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement"/>
 
                                                        <DoubleAnimation Duration="0" To="0.6" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_ContentHost"/>
 
                                                    </Storyboard>
 
                                                </VisualState>
 
                                            </VisualStateGroup>
 
                                            <VisualStateGroup x:Name="WatermarkStates">
 
                                                <VisualState x:Name="WatermarkHidden">
 
                                                    <Storyboard>
 
                                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="WatermarkVisualElement"/>
 
                                                    </Storyboard>
 
                                                </VisualState>
 
                                                <VisualState x:Name="WatermarkVisible"/>
 
                                            </VisualStateGroup>
 
                                        </VisualStateManager.VisualStateGroups>
 
                                        <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Opacity="1"/>
 
                                        <Border x:Name="MouseOverVisual" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsHitTestVisible="False" Opacity="0" Grid.RowSpan="2" Visibility="Collapsed"/>
 
                                        <Border x:Name="DisabledVisualElement" BorderBrush="#FF989898" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" IsHitTestVisible="False" Opacity="0"/>
 
                                        <ScrollViewer x:Name="PART_ContentHost" BorderThickness="0" IsTabStop="False" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
 
                                            <telerik:StyleManager.Theme>
 
                                                <telerik:Office_BlackTheme/>
 
                                            </telerik:StyleManager.Theme>
 
                                        </ScrollViewer>
 
                                        <Border x:Name="FocusVisual" BorderBrush="#FFFFC92B" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" CornerRadius="1" IsHitTestVisible="False" Opacity="0" Grid.RowSpan="2">
 
                                            <Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0"/>
 
                                        </Border>
 
                                        <ContentControl x:Name="WatermarkVisualElement" BorderThickness="{TemplateBinding BorderThickness}" ContentTemplate="{TemplateBinding WatermarkTemplate}" Content="{TemplateBinding WatermarkContent}" FontStyle="Normal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="False" IsTabStop="False" Margin="{TemplateBinding Padding}" Opacity="0.5" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
 
                                    </Grid>
 
                                </ControlTemplate>
 
                            </Setter.Value>
 
                        </Setter>
 
                        <Style.BasedOn>
 
                            <Style TargetType="{x:Type telerik:RadWatermarkTextBox}">
 
                                <Setter Property="Foreground" Value="Black"/>
 
                                <Setter Property="Padding" Value="5,3"/>
 
                                <Setter Property="VerticalContentAlignment" Value="Center"/>
 
                                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
 
                                <Setter Property="AllowDrop" Value="True"/>
 
                                <Setter Property="IsTabStop" Value="True"/>
 
                                <Setter Property="BorderBrush" Value="#FF848484"/>
 
                                <Setter Property="Background" Value="White"/>
 
                                <Setter Property="BorderThickness" Value="1"/>
 
                                <Setter Property="KeyboardNavigation.TabNavigation" Value="Once"/>
 
                                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
 
                                <Setter Property="SnapsToDevicePixels" Value="True"/>
 
                                <Setter Property="Template">
 
                                    <Setter.Value>
 
                                        <ControlTemplate TargetType="{x:Type telerik:RadWatermarkTextBox}">
 
                                            <Grid x:Name="RootElement" Cursor="IBeam">
 
                                                <VisualStateManager.VisualStateGroups>
 
                                                    <VisualStateGroup x:Name="CommonStates">
 
                                                        <VisualState x:Name="Normal">
 
                                                            <Storyboard>
 
                                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverVisual">
 
                                                                    <LinearDoubleKeyFrame KeyTime="0:0:0.15" Value="0"/>
 
                                                                </DoubleAnimationUsingKeyFrames>
 
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="MouseOverVisual">
 
                                                                    <DiscreteObjectKeyFrame KeyTime="0:0:0.15">
 
                                                                        <DiscreteObjectKeyFrame.Value>
 
                                                                            <Visibility>Collapsed</Visibility>
 
                                                                        </DiscreteObjectKeyFrame.Value>
 
                                                                    </DiscreteObjectKeyFrame>
 
                                                                </ObjectAnimationUsingKeyFrames>
 
                                                            </Storyboard>
 
                                                        </VisualState>
 
                                                        <VisualState x:Name="MouseOver">
 
                                                            <Storyboard>
 
                                                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverVisual">
 
                                                                    <LinearDoubleKeyFrame KeyTime="0:0:0.115" Value="1"/>
 
                                                                </DoubleAnimationUsingKeyFrames>
 
                                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="MouseOverVisual">
 
                                                                    <DiscreteObjectKeyFrame KeyTime="0">
 
                                                                        <DiscreteObjectKeyFrame.Value>
 
                                                                            <Visibility>Visible</Visibility>
 
                                                                        </DiscreteObjectKeyFrame.Value>
 
                                                                    </DiscreteObjectKeyFrame>
 
                                                                </ObjectAnimationUsingKeyFrames>
 
                                                            </Storyboard>
 
                                                        </VisualState>
 
                                                        <VisualState x:Name="Disabled">
 
                                                            <Storyboard>
 
                                                                <DoubleAnimation Duration="0" To="0.6" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement"/>
 
                                                                <DoubleAnimation Duration="0" To="0.6" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_ContentHost"/>
 
                                                            </Storyboard>
 
                                                        </VisualState>
 
                                                        <VisualState x:Name="ReadOnly">
 
                                                            <Storyboard>
 
                                                                <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ReadOnlyVisualElement"/>
 
                                                            </Storyboard>
 
                                                        </VisualState>
 
                                                    </VisualStateGroup>
 
                                                    <VisualStateGroup x:Name="FocusStates">
 
                                                        <VisualState x:Name="Focused">
 
                                                            <Storyboard>
 
                                                                <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisual"/>
 
                                                            </Storyboard>
 
                                                        </VisualState>
 
                                                        <VisualState x:Name="Unfocused"/>
 
                                                    </VisualStateGroup>
 
                                                    <VisualStateGroup x:Name="WatermarkStates">
 
                                                        <VisualState x:Name="WatermarkHidden">
 
                                                            <Storyboard>
 
                                                                <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="WatermarkVisualElement"/>
 
                                                            </Storyboard>
 
                                                        </VisualState>
 
                                                        <VisualState x:Name="WatermarkVisible"/>
 
                                                    </VisualStateGroup>
 
                                                </VisualStateManager.VisualStateGroups>
 
                                                <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="1" Opacity="1"/>
 
                                                <Border x:Name="ReadOnlyVisualElement" Background="#5EC9C9C9" CornerRadius="1" Opacity="0"/>
 
                                                <Border x:Name="MouseOverVisual" BorderBrush="#FFFFC92B" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" CornerRadius="1" IsHitTestVisible="False" Opacity="0" Grid.RowSpan="2" Visibility="Collapsed"/>
 
                                                <Border x:Name="DisabledVisualElement" BorderBrush="#FF989898" BorderThickness="{TemplateBinding BorderThickness}" Background="#FFE0E0E0" CornerRadius="1" IsHitTestVisible="False" Opacity="0"/>
 
                                                <ScrollViewer x:Name="PART_ContentHost" BorderThickness="0" Cursor="Arrow" IsTabStop="False" Margin="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
 
                                                    <telerik:StyleManager.Theme>
 
                                                        <telerik:Office_BlackTheme/>
 
                                                    </telerik:StyleManager.Theme>
 
                                                </ScrollViewer>
 
                                                <Border x:Name="FocusVisual" BorderBrush="#FFFFC92B" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" CornerRadius="1" IsHitTestVisible="False" Opacity="0" Grid.RowSpan="2">
 
                                                    <Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0"/>
 
                                                </Border>
 
                                                <ContentControl x:Name="WatermarkVisualElement" BorderThickness="{TemplateBinding BorderThickness}" ContentTemplate="{TemplateBinding WatermarkTemplate}" Content="{TemplateBinding WatermarkContent}" Foreground="{TemplateBinding Foreground}" FontStyle="Italic" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="False" IsTabStop="False" Margin="2,0,0,0" Opacity="0.5" Padding="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
 
                                                    <ContentControl.Template>
 
                                                        <ControlTemplate TargetType="{x:Type ContentControl}">
 
                                                            <Border BorderThickness="{TemplateBinding BorderThickness}">
 
                                                                <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Margin="{TemplateBinding Padding}"/>
 
                                                            </Border>
 
                                                        </ControlTemplate>
 
                                                    </ContentControl.Template>
 
                                                </ContentControl>
 
                                            </Grid>
 
                                        </ControlTemplate>
 
                                    </Setter.Value>

 

 

 
                                </Setter>
 
                            </Style>
 
                        </Style.BasedOn>
 
                    </Style>
 
                </Setter.Value>
 
            </Setter>
 
            <Setter Property="Template">
 
                <Setter.Value>
 
                    <ControlTemplate TargetType="{x:Type telerik:RadAutoCompleteBox}">
 
                        <Grid>
 
                            <VisualStateManager.VisualStateGroups>
 
                                <VisualStateGroup x:Name="CommonStates">
 
                                    <VisualState x:Name="Normal"/>
 
                                    <VisualState x:Name="MouseOver">
 
                                        <Storyboard>
 
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverVisual"/>
 
                                        </Storyboard>
 
                                    </VisualState>
 
                                    <VisualState x:Name="Disabled">
 
                                        <Storyboard>
 
                                            <DoubleAnimation Duration="0" To="0.6" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement"/>
 
                                        </Storyboard>
 
                                    </VisualState>
 
                                </VisualStateGroup>
 
                                <VisualStateGroup x:Name="FocusStates">
 
                                    <VisualState x:Name="Unfocused"/>
 
                                    <VisualState x:Name="Focused">
 
                                        <Storyboard>
 
                                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="FocusVisual"/>
 
                                        </Storyboard>
 
                                    </VisualState>
 
                                </VisualStateGroup>
 
                            </VisualStateManager.VisualStateGroups>
 
                            <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="1"/>
 
                            <Border x:Name="MouseOverVisual" BorderBrush="#FFFFC92B" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="1" Opacity="0"/>
 
                            <Border x:Name="FocusVisual" BorderBrush="#FFFFC92B" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="1" IsHitTestVisible="False" Opacity="0">
 
                                <Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="0"/>
 
                            </Border>
 
                            <Border x:Name="DisabledVisualElement" BorderBrush="#FF989898" BorderThickness="{TemplateBinding BorderThickness}" Background="#FFE0E0E0" CornerRadius="1" IsHitTestVisible="False" Opacity="0"/>
 
                            <ScrollViewer x:Name="PART_ScrollViewer" BorderThickness="0" Background="Transparent" Height="{TemplateBinding Height}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" IsTabStop="False" Margin="{TemplateBinding BorderThickness}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
 
                                <telerik:StyleManager.Theme>
 
                                    <telerik:Office_BlackTheme/>
 
                                </telerik:StyleManager.Theme>
 
                                <telerik:AutoCompleteBoxesItemsControl x:Name="PART_Boxes"
 
                                                                      BoxesItemTemplate="{TemplateBinding BoxesItemTemplate}"
 
                                                                      DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
 
                                                                      Foreground="{TemplateBinding Foreground}"
 
                                                                      Height="{TemplateBinding Height}"
 
                                                                      ScrollViewer.HorizontalScrollBarVisibility="Disabled"
 
                                                                      IsTabStop="False"
 
                                                                      Margin="{TemplateBinding Padding}"
 
                                                                      ScrollViewer.VerticalScrollBarVisibility="Disabled" >
 
                                    <telerik:AutoCompleteBoxesItemsControl.ItemsPanel>
 
                                        <ItemsPanelTemplate>
 
                                            <telerik:AutoCompleteBoxesWrapPanel IsItemsHost="True" Width="{Binding ActualWidth, ElementName=WatermarkTextBox}"/>
 
                                        </ItemsPanelTemplate>
 
                                    </telerik:AutoCompleteBoxesItemsControl.ItemsPanel>
 
 
 
                                    <telerik:AutoCompleteBoxesItemsControl.ItemContainerStyle>
 
                                        <Style TargetType="{x:Type telerik:RadAutoCompleteBoxItem}">
 
                                            <Setter Property="Template">
 
                                                <Setter.Value>
 
                                                    <ControlTemplate TargetType="{x:Type telerik:RadAutoCompleteBoxItem}">
 
                                                        <Border CornerRadius="1" x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
 
                                                            <StackPanel Orientation="Horizontal">
 
                                                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
 
 
 
                                                            </StackPanel>
 
 
 
                                                        </Border>
 
                                                    </ControlTemplate>
 
                                                </Setter.Value>
 
                                            </Setter>
 
                                        </Style>
 
                                    </telerik:AutoCompleteBoxesItemsControl.ItemContainerStyle>
 
 
 
                                </telerik:AutoCompleteBoxesItemsControl>
 
                            </ScrollViewer>
 
                            <Popup x:Name="PART_Popup">
 
                                <Grid x:Name="PopupRoot">
 
                                    <telerik:RadListBox x:Name="PART_ListBox"
 
                                                        CanKeyboardNavigationSelectItems="{x:Null}"
 
                                                        IsTabStop="False"
 
                                                        ItemTemplate="{TemplateBinding DropDownItemTemplate}"
 
                                                        IsTextSearchEnabled="True"
 
                                                        MaxHeight="{TemplateBinding MaxDropDownHeight}"
 
                                                        MinWidth="{TemplateBinding MinDropDownWidth}"
 
                                                        SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
 
                                                        SelectedValueBinding="{x:Null}"
 
                                                        TextBinding="{x:Null}"
 
                                                        ItemsSource="{TemplateBinding FilteredItems}">
 
 
 
                                        <telerik:StyleManager.Theme>
 
                                            <telerik:Office_BlackTheme/>
 
                                        </telerik:StyleManager.Theme>
 
                                    </telerik:RadListBox>
 
                                </Grid>
 
                            </Popup>
 
                        </Grid>
 
                    </ControlTemplate>
 
                </Setter.Value>
 
            </Setter>
 
            <Setter Property="BorderBrush" Value="#FF848484"/>
 
            <Setter Property="BorderThickness" Value="1"/>
 
            <Setter Property="Background" Value="White"/>
 
            <Setter Property="Padding" Value="0,0,3,3"/>
 
            <Setter Property="Cursor" Value="IBeam"/>
 
            <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled"/>
 
            <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
 
            <Setter Property="SnapsToDevicePixels" Value="True"/>
 
        </Style>
Bjorn
Top achievements
Rank 1
 asked on 08 Apr 2017
2 answers
487 views

Hello,

Let's suppose I have a large DB of vehicles. One of the tables is tblColors that has a numeric ColorCode and a string ColorName (say there's about a hundred of those).

The main table contains a ColorCode of the vehicle but I need to show ColorName in my grid. What I do is I create a TypeConverter that goes like

public class ColorConverter
{
  public object Convert(object, Type, object, CultureInfo)
  {
    byte? colorCode = value as byte?;
    swtich (colorCode)
    {
      case 1: return "White";
                  break;
      .....
    }
........
}

 

Then I go to my grid and create a column:

...
<Grid.Resources>
  <r:ColorConverter x:Key="ColorConverter" />
</Grid.Resources>
...
 
<telerik:RadGridView Name="myGrid" AutoGenerateColumns="false" ... >
  <telerik:RadGridView.Columns>
    ...
    <telerik:GridViewDataColumn Header="Color" DataMemberBinding="{Binding ColorCode, Converter={StaticResource ColorConverter}}" />
    ...
  </telerik:RadGridViewColumns>
  ...
</telerik:RadGridView>

 

First of all: am I doing this right? I don't want to query my other table on each row loading so I just preload (or hard-code) the code->name relation.

Second question is, now when I click on the filtering symbol for the Color column, I'm getting the numbers not the converted values. I could preload the values (as a List<String>) in the DistinctValuesLoading event but then when I'm trying to filter I'm getting a "System.FormatException: Input string was not in a correct format."

Thank you.

 

Alex
Top achievements
Rank 1
 answered on 07 Apr 2017
2 answers
354 views
I am trying to create the slider design demonstrated in the attachment (with making tick crossing the track of the slider), but I had many difficulties. Is it possible to do this design? what is the simplest way to do it? I hope the answer is explained with a sample project. 
Evgenia
Telerik team
 answered on 07 Apr 2017
2 answers
208 views

Hello.

If RadCartesianChart uses an instance of RadObservableColection as DataSource and there are a lot of data points (for example 100000 points of data) in this RadObservableColection, is there (in this case) RadCartesianChart works with virtual (disk) memory (locating RadObservableColection in virtual memory)? Or RadCartesianChart uses only RAM memory space in this case (so RadObservableCollection is in the computer's RAM)?

Dmitry
Top achievements
Rank 1
 answered on 07 Apr 2017
3 answers
918 views

What role does RadGridViewAutomationPeer? 

I have a RadGridView in my application, but when I change my DataContext to a new object containing a new List for the ItemsSource, the RadGridView is still holding all the old objects from the old List used by the ItemsSource in memory through this RadGridViewAutomationPeer. Not knowing what the AutomationPeer does, I'm at a bit of a loss as to how to get it to release those old objects. I wasn't able to find any useful information on this class. I've attached the memory retention chart from dotMemory showing my CurveSets being held.

Here's the xaml for the chart:

 

<telerik:RadGridView
    x:Name="CurveList"
    Grid.Row="1"
    AutoGenerateColumns="False" ItemsSource="{Binding Path=Wells}"
    IsFilteringAllowed="False" ShowGroupPanel="False" CanUserSortColumns="False"
    SelectionMode="Single"
    IsSynchronizedWithCurrentItem="True"
    CurrentItem="{Binding Path=DeclineConsolidator.CurrentCurve, Mode=TwoWay}"
    GroupRenderMode="Flat" EnableRowVirtualization="True">
    <telerik:RadGridView.Resources>
        <consolidator:WellNameStyleSelector x:Key="NameStyleSelector">
            <consolidator:WellNameStyleSelector.CleanStyle>
                <Style TargetType="{x:Type telerik:GridViewCell}">
                    <Setter Property="FontStyle" Value="Normal" />
                </Style>
            </consolidator:WellNameStyleSelector.CleanStyle>
            <consolidator:WellNameStyleSelector.DirtyStyle>
                <Style TargetType="{x:Type telerik:GridViewCell}">
                    <Setter Property="FontStyle" Value="Italic" />
                </Style>
            </consolidator:WellNameStyleSelector.DirtyStyle>
        </consolidator:WellNameStyleSelector>
    </telerik:RadGridView.Resources>
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn Header="" Width="25" MaxWidth="25" MinWidth="25" IsReadOnly="True">
            <telerik:GridViewDataColumn.CellTemplate>
                <DataTemplate>
                    <Image
                        Source="{Binding Source={x:Static pcc:ImageSourceConstants.WarningIcon}}"
                        Visibility="{Binding Path=IsValid, Converter={StaticResource InverseBoolToVisibilityConverter}}"
                        Tag="{Binding Path=ErrorMessageAlert}"
                        Width="15" Height="15" Margin="0,0,0,0">
                        <i:Interaction.Behaviors>
                            <infrastructure:ImageGridValidationBehaviour />
                        </i:Interaction.Behaviors>
                    </Image>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellTemplate>
        </telerik:GridViewDataColumn>
        <telerik:GridViewDataColumn Header="{x:Static prop:Resources.WellListColumnHeader}"
                                    IsReadOnly="True"
                                    DataMemberBinding="{Binding Path=DisplayName}" Width="*"
                                    CellStyleSelector="{StaticResource NameStyleSelector}" />
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

 

 

Martin
Telerik team
 answered on 07 Apr 2017
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
DataPager
PersistenceFramework
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
InlineAIAssistant
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?