Telerik Forums
UI for WPF Forum
3 answers
134 views

Hello,

I am using a RadGridView. I set my source to an ObservableCollection of objects that represent my rows of data. During run time, rather than seeing the value of property in the column cells, I see System.WeakReference.

Any clue as to what this could be due to?

Thanks,

Brian

Ivan Ivanov
Telerik team
 answered on 22 Aug 2017
7 answers
785 views
I'm building a WPF application that will be running on laptops mounted in police cars.  The colors need to change when a user clicks on a button, one set of colors for Day time and another set for Night time.  The idea is that the night time colors will be easier on the user's eyes in a dark police car at night.

I've implemented themes in my application.  I use them to switch between "Day Time" colors and "Night Time" colors.  This is done by switching between two different ResourceDictionaries, one for Day Time and one for Night Time.

I'm using a RadTabControl in my application and I cannot get its headerr to swap colors at all.  Using Expression Blend, I've made a copy of the RadTabControl's template.  Using Snoop, I inspected my program's visual tree and found that changing the background color of the Border control named "HeaderBackground" would change the background color of the header row.  So I edited the copy of the RadTabControl's template and put my values into the template for that control, as shown below:

<Style TargetType="{x:Type telerik:RadTabControl}">
    <Setter Property="MinWidth"                   Value="5" />
    <Setter Property="MinHeight"                  Value="26" />
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="VerticalContentAlignment"   Value="Stretch" />
    <Setter Property="IsTabStop"                  Value="False" />
    <Setter Property="BorderBrush"                Value="{DynamicResource TabBorder}" />
    <Setter Property="BorderThickness"            Value="1,0,1,1" />
    <Setter Property="Background"                 Value="{DynamicResource TabBackground}" />
    <Setter Property="ItemsPanel">
        <Setter.Value>
            <ItemsPanelTemplate>
                <Telerik_Windows_Controls_Primitives:TabWrapPanel IsItemsHost="True" />
            </ItemsPanelTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="DropDownButtonStyle">
        <Setter.Value>
            <Style TargetType="{x:Type ToggleButton}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Grid>
                                <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                                    <Border x:Name="InnerBorder" BorderBrush="White" BorderThickness="1" />
                                </Border>
                                <Border x:Name="CheckedVisual" BorderBrush="#FFFFC92B" BorderThickness="{TemplateBinding BorderThickness}" Opacity="0">
                                    <Border.Background>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FFFFDCAB" Offset="0" />
                                            <GradientStop Color="#FFFFD18F" Offset="0.5" />
                                            <GradientStop Color="#FFFE9227" Offset="0.5" />
                                            <GradientStop Color="#FFFFD74E" Offset="1" />
                                        </LinearGradientBrush>
                                    </Border.Background>
                                    <Border BorderBrush="White" BorderThickness="1" />
                                </Border>
                                <ContentPresenter x:Name="ContentPresenter"
                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                  Content="{TemplateBinding Content}"
                                                  HorizontalAlignment="Center"
                                                  Margin="{TemplateBinding Padding}"
                                                  VerticalAlignment="Center" />
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="BorderBrush" TargetName="Border" Value="#FFFFC92B" />
                                    <Setter Property="BorderBrush" TargetName="InnerBorder" Value="White" />
                                    <Setter Property="Background" TargetName="Border">
                                        <Setter.Value>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FFFFFBDA" Offset="0" />
                                                <GradientStop Color="#FFFEEBAE" Offset="0.5" />
                                                <GradientStop Color="#FFFFD25A" Offset="0.5" />
                                                <GradientStop Color="#FFFFFBA3" Offset="1" />
                                            </LinearGradientBrush>
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True">
                                    <Setter Property="BorderBrush" TargetName="Border">
                                        <Setter.Value>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FF282828" />
                                                <GradientStop Color="#FF5F5F5F" Offset="1" />
                                            </LinearGradientBrush>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="BorderBrush" TargetName="InnerBorder">
                                        <Setter.Value>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FFB69A78" />
                                                <GradientStop Color="#FFFFE17A" Offset="0.126" />
                                            </LinearGradientBrush>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Background" TargetName="Border">
                                        <Setter.Value>
                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                <GradientStop Color="#FFFFDCAB" Offset="0" />
                                                <GradientStop Color="#FFFFD18F" Offset="0.5" />
                                                <GradientStop Color="#FFFE9227" Offset="0.5" />
                                                <GradientStop Color="#FFFFBA74" Offset="0" />
                                            </LinearGradientBrush>
                                        </Setter.Value>
                                    </Setter>
                                </Trigger>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Opacity" TargetName="CheckedVisual" Value="1" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Content" Value="" />
                <Setter Property="ContentTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <Path Data="M0,0L6,0 6,1 0,1 M0,2L6,2 6,3 5,3 5,4 4,4 4,5 2,5 2,4 1,4 1,3 0,3 0,2" Fill="Black" SnapsToDevicePixels="True" />
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Padding" Value="5,3" />
                <Setter Property="telerik:RadDockPanel.Dock" Value="Right" />
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="White" Offset="0" />
                            <GradientStop Color="Gainsboro" Offset="0.5" />
                            <GradientStop Color="#FFADADAD" Offset="0.5" />
                            <GradientStop Color="#FFD4D4D4" Offset="1" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
                <Setter Property="BorderBrush" Value="#FF848484" />
                <Setter Property="BorderThickness" Value="1" />
                <Setter Property="IsTabStop" Value="False" />
            </Style>
        </Setter.Value>
    </Setter>
    <Setter Property="DropDownStyle">
        <Setter.Value>
            <Style TargetType="{x:Type Telerik_Windows_Controls_TabControl:DropDownMenu}">
                <Setter Property="Background" Value="White" />
                <Setter Property="VerticalContentAlignment" Value="Center" />
                <Setter Property="BorderThickness" Value="1" />
                <Setter Property="MaxHeight" Value="500" />
                <Setter Property="BorderBrush" Value="#FF848484" />
                <Setter Property="ItemsPanel">
                    <Setter.Value>
                        <ItemsPanelTemplate>
                            <telerik:RadWrapPanel IsItemsHost="True" Orientation="Vertical" />
                        </ItemsPanelTemplate>
                    </Setter.Value>
                </Setter>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Telerik_Windows_Controls_TabControl:DropDownMenu}">
                            <Grid>
                                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                                    <Border BorderBrush="#FF848484" BorderThickness="0,2,0,0">
                                        <ItemsPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                        Margin="{TemplateBinding Padding}"
                                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                    </Border>
                                </Border>
                                <Rectangle x:Name="BorderMaskElement" Fill="Transparent" HorizontalAlignment="Left" VerticalAlignment="Top" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Setter.Value>
    </Setter>
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type telerik:RadTabControl}">
                <Grid>
                    <telerik:RadDockPanel LastChildFill="True">
                        <telerik:LayoutTransformControl x:Name="HeaderDockedElement" telerik:RadDockPanel.Dock="Top" IsTabStop="False">
                            <Grid>
                                <Border Background="{DynamicResource TabHeaderBackground}" BorderBrush="{DynamicResource TabBorder}" x:Name="HeaderBackground" Visibility="{TemplateBinding BackgroundVisibility}" />
                                <Border Background="{DynamicResource TabHeaderBackground}"  BorderBrush="{DynamicResource TabBorder}" BorderThickness="0,0,0,1" SnapsToDevicePixels="True" />
                                <telerik:RadDockPanel Panel.ZIndex="10">
                                    <ToggleButton x:Name="DropDownButtonElement" ClickMode="Press" telerik:RadDockPanel.Dock="Right"
                                                  IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                                  Margin="2,4,4,2" Style="{TemplateBinding DropDownButtonStyle}" Visibility="Collapsed">
                                        <telerik:RadContextMenu.ContextMenu>
                                            <Telerik_Windows_Controls_TabControl:DropDownMenu x:Name="DropDownMenuElement"
                                                                                              ClickToOpen="True"
                                                                                              DisplayMemberPath="{TemplateBinding DropDownDisplayMemberPath}"
                                                                                              ItemTemplate="{TemplateBinding ItemDropDownContentTemplate}"
                                                                                              Placement="Bottom"
                                                                                              Style="{TemplateBinding DropDownStyle}"
                                                                                              StaysOpen="False" />
                                        </telerik:RadContextMenu.ContextMenu>
                                    </ToggleButton>
                                    <RepeatButton x:Name="LeftScrollButtonElement" Margin="4,4,2,2" Visibility="{Binding ComputedHorizontalScrollBarVisibility, ElementName=ScrollViewerElement}">
                                        <RepeatButton.Style>
                                            <Style TargetType="{x:Type RepeatButton}">
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                            <Grid>
                                                                <Border x:Name="ButtonBorder">
                                                                    <Grid>
                                                                        <Telerik_Windows_Controls_Chromes:ButtonChrome x:Name="ButtonVisual"
                                                                                                                       BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource TemplatedParent}}"
                                                                                                                       BorderThickness="1"
                                                                                                                       Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
                                                                                                                       CornerRadius="2,0,0,2"
                                                                                                                       RenderMouseOver="{TemplateBinding IsMouseOver}"
                                                                                                                       RenderPressed="{TemplateBinding IsPressed}"
                                                                                                                       RenderEnabled="{TemplateBinding IsEnabled}">
                                                                            <telerik:StyleManager.Theme>
                                                                                <telerik:Office_BlackTheme />
                                                                            </telerik:StyleManager.Theme>
                                                                        </Telerik_Windows_Controls_Chromes:ButtonChrome>
                                                                        <Path x:Name="Path"
                                                                              Data="F1M110.692,342.252L110.692,352.682 104.594,347.467 110.692,342.252z"
                                                                              Fill="Black"
                                                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                                              Height="7"
                                                                              Margin="{TemplateBinding Padding}"
                                                                              Stretch="Uniform"
                                                                              SnapsToDevicePixels="True"
                                                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                                              Width="5" />
                                                                    </Grid>
                                                                </Border>
                                                            </Grid>
                                                            <ControlTemplate.Triggers>
                                                                <Trigger Property="IsMouseOver" Value="True" />
                                                                <Trigger Property="IsPressed" Value="True" />
                                                                <Trigger Property="IsEnabled" Value="False">
                                                                    <Setter Property="Opacity" TargetName="ButtonBorder" Value="0" />
                                                                </Trigger>
                                                            </ControlTemplate.Triggers>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                                <Setter Property="Width" Value="17" />
                                                <Setter Property="Content" Value="" />
                                                <Setter Property="Padding" Value="5,1" />
                                                <Setter Property="Margin" Value="2" />
                                                <Setter Property="telerik:RadDockPanel.Dock" Value="Left" />
                                                <Setter Property="Background">
                                                    <Setter.Value>
                                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                            <GradientStop Color="White" Offset="0" />
                                                            <GradientStop Color="Gainsboro" Offset="0.5" />
                                                            <GradientStop Color="#FFADADAD" Offset="0.5" />
                                                            <GradientStop Color="#FFD4D4D4" Offset="1" />
                                                        </LinearGradientBrush>
                                                    </Setter.Value>
                                                </Setter>
                                                <Setter Property="BorderBrush" Value="#FF848484" />
                                                <Setter Property="IsTabStop" Value="False" />
                                            </Style>
                                        </RepeatButton.Style>
                                    </RepeatButton>
                                    <RepeatButton x:Name="RightScrollButtonElement" telerik:RadDockPanel.Dock="Right" Margin="2,4,2,2"
                                                  Visibility="{Binding ComputedHorizontalScrollBarVisibility, ElementName=ScrollViewerElement}">
                                        <RepeatButton.Style>
                                            <Style TargetType="{x:Type RepeatButton}">
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                            <Grid>
                                                                <Border x:Name="ButtonBorder">
                                                                    <Grid>
                                                                        <Telerik_Windows_Controls_Chromes:ButtonChrome x:Name="ButtonVisual"
                                                                                                                       BorderBrush="{Binding BorderBrush, RelativeSource={RelativeSource TemplatedParent}}"
                                                                                                                       BorderThickness="1"
                                                                                                                       Background="{Binding Background, RelativeSource={RelativeSource TemplatedParent}}"
                                                                                                                       CornerRadius="0,2,2,0"
                                                                                                                       RenderMouseOver="{TemplateBinding IsMouseOver}"
                                                                                                                       RenderPressed="{TemplateBinding IsPressed}"
                                                                                                                       RenderEnabled="{TemplateBinding IsEnabled}">
                                                                            <telerik:StyleManager.Theme>
                                                                                <telerik:Office_BlackTheme />
                                                                            </telerik:StyleManager.Theme>
                                                                        </Telerik_Windows_Controls_Chromes:ButtonChrome>
                                                                        <Path x:Name="Path"
                                                                              Data="M0.5,0.5L5.2,5.4 5.2,5.4 0.5,10.5z"
                                                                              Fill="Black"
                                                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                                              Height="7"
                                                                              Margin="{TemplateBinding Padding}"
                                                                              Stretch="Uniform"
                                                                              SnapsToDevicePixels="True"
                                                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                                              Width="5" />
                                                                    </Grid>
                                                                </Border>
                                                            </Grid>
                                                            <ControlTemplate.Triggers>
                                                                <Trigger Property="IsMouseOver"
                                                                         Value="True" />
                                                                <Trigger Property="IsPressed"
                                                                         Value="True" />
                                                                <Trigger Property="IsEnabled"
                                                                         Value="False">
                                                                    <Setter Property="Visibility"
                                                                            TargetName="ButtonBorder"
                                                                            Value="Collapsed" />
                                                                </Trigger>
                                                            </ControlTemplate.Triggers>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                                <Setter Property="Width"
                                                        Value="17" />
                                                <Setter Property="Content"
                                                        Value="" />
                                                <Setter Property="Padding"
                                                        Value="5,1" />
                                                <Setter Property="Margin"
                                                        Value="2" />
                                                <Setter Property="telerik:RadDockPanel.Dock"
                                                        Value="Left" />
                                                <Setter Property="Background">
                                                    <Setter.Value>
                                                        <LinearGradientBrush EndPoint="0.5,1"
                                                                             StartPoint="0.5,0">
                                                            <GradientStop Color="White"
                                                                          Offset="0" />
                                                            <GradientStop Color="Gainsboro"
                                                                          Offset="0.5" />
                                                            <GradientStop Color="#FFADADAD"
                                                                          Offset="0.5" />
                                                            <GradientStop Color="#FFD4D4D4"
                                                                          Offset="1" />
                                                        </LinearGradientBrush>
                                                    </Setter.Value>
                                                </Setter>
                                                <Setter Property="BorderBrush"
                                                        Value="#FF848484" />
                                                <Setter Property="IsTabStop"
                                                        Value="False" />
                                            </Style>
                                        </RepeatButton.Style>
                                    </RepeatButton>
                                    <ScrollViewer x:Name="ScrollViewerElement"
                                                  BorderThickness="0"
                                                  HorizontalScrollBarVisibility="{Binding (ScrollViewer.HorizontalScrollBarVisibility), RelativeSource={RelativeSource TemplatedParent}}"
                                                  IsTabStop="False"
                                                  Margin="2,4,2,0"
                                                  VerticalScrollBarVisibility="Disabled">
                                        <ScrollViewer.Style>
                                            <Style TargetType="{x:Type ScrollViewer}">
                                                <Setter Property="HorizontalContentAlignment"
                                                        Value="Left" />
                                                <Setter Property="VerticalContentAlignment"
                                                        Value="Top" />
                                                <Setter Property="Padding"
                                                        Value="0" />
                                                <Setter Property="BorderThickness"
                                                        Value="0" />
                                                <Setter Property="BorderBrush"
                                                        Value="Transparent" />
                                                <Setter Property="Template">
                                                    <Setter.Value>
                                                        <ControlTemplate TargetType="{x:Type ScrollViewer}">
                                                            <Border BorderBrush="{TemplateBinding BorderBrush}"
                                                                    BorderThickness="{TemplateBinding BorderThickness}"
                                                                    CornerRadius="2">
                                                                <Grid Background="{TemplateBinding Background}">
                                                                    <Grid.ColumnDefinitions>
                                                                        <ColumnDefinition Width="*" />
                                                                        <ColumnDefinition Width="Auto" />
                                                                    </Grid.ColumnDefinitions>
                                                                    <Grid.RowDefinitions>
                                                                        <RowDefinition Height="*" />
                                                                        <RowDefinition Height="Auto" />
                                                                    </Grid.RowDefinitions>
                                                                    <ScrollContentPresenter x:Name="ScrollContentPresenter"
                                                                                            Cursor="{TemplateBinding Cursor}"
                                                                                            CanHorizontallyScroll="False"
                                                                                            CanVerticallyScroll="False"
                                                                                            ContentTemplate="{TemplateBinding ContentTemplate}"
                                                                                            Content="{TemplateBinding Content}"
                                                                                            Margin="{TemplateBinding Padding}" />
                                                                </Grid>
                                                            </Border>
                                                        </ControlTemplate>
                                                    </Setter.Value>
                                                </Setter>
                                            </Style>
                                        </ScrollViewer.Style>
                                        <ItemsPresenter />
                                    </ScrollViewer>
                                </telerik:RadDockPanel>
                            </Grid>
                        </telerik:LayoutTransformControl>
                        <Border x:Name="ContentBorder"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                Background="{TemplateBinding Background}"
                                Padding="{TemplateBinding Padding}">
                            <Grid>
                                <ContentPresenter x:Name="ContentElement"
                                                  ContentTemplate="{TemplateBinding SelectedContentTemplate}">
                                    <ContentPresenter.Visibility>
                                        <Binding Path="IsContentPreserved"
                                                 RelativeSource="{RelativeSource TemplatedParent}">
                                            <Binding.Converter>
                                                <telerik:InvertedBooleanToVisibilityConverter />
                                            </Binding.Converter>
                                        </Binding>
                                    </ContentPresenter.Visibility>
                                </ContentPresenter>
                                <Grid x:Name="ContentElementsPanel">
                                    <Grid.Visibility>
                                        <Binding Path="IsContentPreserved"
                                                 RelativeSource="{RelativeSource TemplatedParent}">
                                            <Binding.Converter>
                                                <telerik:BooleanToVisibilityConverter />
                                            </Binding.Converter>
                                        </Binding>
                                    </Grid.Visibility>
                                </Grid>
                            </Grid>
                        </Border>
                    </telerik:RadDockPanel>
                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="DropDownDisplayMode"
                             Value="Visible">
                        <Setter Property="Visibility"
                                TargetName="DropDownButtonElement"
                                Value="Visible" />
                    </Trigger>
                    <MultiTrigger>
                        <MultiTrigger.Conditions>
                            <Condition Property="DropDownDisplayMode"
                                       Value="WhenNeeded" />
                            <Condition Property="ComputedHorizontalScrollBarVisibility"
                                       SourceName="ScrollViewerElement"
                                       Value="Visible" />
                        </MultiTrigger.Conditions>
                        <Setter Property="Visibility"
                                TargetName="DropDownButtonElement"
                                Value="Visible" />
                    </MultiTrigger>
                    <Trigger Property="TabStripPlacement"
                             Value="Left">
                        <Setter Property="telerik:RadDockPanel.Dock"
                                TargetName="HeaderDockedElement"
                                Value="Left" />
                        <Setter Property="LayoutTransform"
                                TargetName="HeaderDockedElement">
                            <Setter.Value>
                                <RotateTransform Angle="-90" />
                            </Setter.Value>
                        </Setter>
                        <Setter Property="BorderThickness"
                                Value="0,1,1,1" />
                    </Trigger>
                    <Trigger Property="TabStripPlacement"
                             Value="Right">
                        <Setter Property="telerik:RadDockPanel.Dock"
                                TargetName="HeaderDockedElement"
                                Value="Right" />
                        <Setter Property="LayoutTransform"
                                TargetName="HeaderDockedElement">
                            <Setter.Value>
                                <RotateTransform Angle="90" />
                            </Setter.Value>
                        </Setter>
                        <Setter Property="BorderThickness"
                                Value="1,1,0,1" />
                    </Trigger>
                    <Trigger Property="TabStripPlacement"
                             Value="Bottom">
                        <Setter Property="telerik:RadDockPanel.Dock"
                                TargetName="HeaderDockedElement"
                                Value="Bottom" />
                        <Setter Property="LayoutTransform"
                                TargetName="HeaderDockedElement">
                            <Setter.Value>
                                <RotateTransform Angle="180" />
                            </Setter.Value>
                        </Setter>
                        <Setter Property="BorderThickness"
                                Value="1,1,1,0" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

This does not have the desired effect, however.  It appears that the {DynamicResource xxx} values I've specified are overridden somewhere, because every time I run the program and change to night mode, the colors do not change.

What am I doing wrong here?  What is the correct way to do what I want to do?  Here's the XAML for the RadTabControl in my program:

<telerik:RadTabControl Background="{DynamicResource ContentBackground}"
                       FontSize="22"
                       FontWeight="Bold"
                       Grid.Column="0"
                       Name="OperationsTabs"
                       SelectionChanged="Tabs_SelectionChanged"
                       Visibility="Collapsed">
    <telerik:RadTabItem . . . />
</telerik:RadTabControl>
                
Petar Mladenov
Telerik team
 answered on 22 Aug 2017
1 answer
314 views

Hi,

In RadDiagram i am able to disable copy ,cut and paste using AllowCopy="False" AllowCut="False" AllowPaste="False" .

How do i disable undo(Ctrl+Z) & redo( Ctrl+Y) functionality ?

Thanks

Deepak Deshmukh

Dinko | Tech Support Engineer
Telerik team
 answered on 21 Aug 2017
1 answer
127 views
As you can see in the attached picture my problem is pretty straight forward, I am getting this weird silver color on the pin button. Same color is observed on the purple tab also. The hover color is correcly orange thought.
Martin
Telerik team
 answered on 21 Aug 2017
1 answer
105 views
How can I hide the rows and columns, but keep the full text search.
Dilyan Traykov
Telerik team
 answered on 21 Aug 2017
2 answers
371 views

Hi,

I have a little problem with my scroll on RadGridView. One of my column's cell template is RadTreeView. When mouse is over tree, mouse-wheel move does not take affect on RadGridView scroll. When mouse is over any other cell, mouse-wheel scroll works correct, like always. It looks like RadTreeView inside cell is stealing mouse-wheel event and RadGridView doesn't scroll? Because my cell height is adjusting itself to RadTreeView size, there is no scroll bars inside cell, it is ok, I want scroll only on RadGridView.

 

Thanks for any help!

Jakub
Top achievements
Rank 1
Iron
 answered on 21 Aug 2017
8 answers
433 views
I have a RadDropDownButton which DropDownContent is a StackPanel (which in turn contains other controls).

The issue I am having is, defining a Tooltip for the RadDropDownButton results in the Tooltip also being displayed on the dropped-down StackPanel (except for any position that then contains another control).

The intent is only to display the Tooltip on the button itself, and not on the resultant StackPanel that flies out when the button is pressed. Currently the workaround is to have an image displayed on the button and then have the tooltip attached to the image. But, I would like to know if there is a better fix for this.
Stefan
Telerik team
 answered on 21 Aug 2017
3 answers
195 views

As the title says, when I bind an ImageColumn to a URL which points to a an image on the web, I get an exception in the event of the image not being available (for example if the server is down). Is there any way to prevent this?

Value cannot be null.
Parameter name: uriSource

at System.Windows.Media.Imaging.BitmapImage..ctor(Uri uriSource, RequestCachePolicy uriCachePolicy)
at Telerik.Windows.Controls.GridViewImageColumn.Image_ImageFailed(Object sender, ExceptionRoutedEventArgs e)
Stefan
Telerik team
 answered on 21 Aug 2017
1 answer
299 views

Hello!

There are the following types of data:

namespace TelerikHierarchyChildTemplate.Model
{
    public class WatchList
    {
        public int WatchListId { get; set; }
        public string Moniker { get; set; }
        public ICollection<ContentWatchList> Content { get; set; }
    }
 
    public class ContentWatchList
    {
        public int ContentWatchListId { get; set; }
        public WatchList ParentWatchList { get; set; }
        public Item ItemItem { get; set; }
    }
 
    public class Item
    {
        public int ItemId { get; set; }
        public string Moniker { get; set; }
        public string Note { get; set; }
        public ICollection<ContentWatchList> ContentsWatchLists { get; set; }
    }
}

 

There is a model (MainViewModel) that in the creation fills the collection. To be filled in correctly :)

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Telerik.Windows.Controls;
using TelerikHierarchyChildTemplate.Model;
 
namespace TelerikHierarchyChildTemplate
{
    public class MainViewModel : ViewModelBase
    {
        private ObservableCollection<WatchList> _watchListsCollection;
        private ObservableCollection<ContentWatchList> _contentWatchListCollection;
        private ObservableCollection<Item> _itemsCollection;
 
        public ObservableCollection<WatchList> WatchListsCollection
        {
            get { return _watchListsCollection; }
            set
            {
                _watchListsCollection = value;
                OnPropertyChanged(()=> WatchListsCollection);
            }
        }
 
        public ObservableCollection<ContentWatchList> ContentWatchListCollection
        {
            get { return _contentWatchListCollection; }
            set
            {
                _contentWatchListCollection = value;
                OnPropertyChanged(()=>ContentWatchListCollection);
            }
        }
 
        public ObservableCollection<Item> ItemsCollection
        {
            get { return _itemsCollection; }
            set
            {
                _itemsCollection = value;
                OnPropertyChanged(()=> ItemsCollection);
            }
        }
 
        public MainViewModel()
        {
            WatchListsCollection = new ObservableCollection<WatchList>
            {
                new WatchList()
                {
                    WatchListId = 0,
                    Moniker = "List One",
                    Content = new List<ContentWatchList>()
                },
 
                new WatchList()
                {
                    WatchListId = 1,
                    Moniker = "List Two",
                    Content = new List<ContentWatchList>()
                },
 
                new WatchList()
                {
                    WatchListId = 2,
                    Moniker = "List Three",
                    Content = new List<ContentWatchList>()
                }
            };
 
            ItemsCollection = new ObservableCollection<Item>
            {
                new Item()
                {
                    ItemId = 0,
                    Moniker = "Item One",
                    Note = "Note One",
                    ContentsWatchLists = new List<ContentWatchList>()
                },
 
                new Item()
                {
                    ItemId = 1,
                    Moniker = "Item Two",
                    Note = "Note Two",
                    ContentsWatchLists = new List<ContentWatchList>()
                },
 
                new Item()
                {
                    ItemId = 2,
                    Moniker = "Item Three",
                    Note = "Note Tree",
                    ContentsWatchLists = new List<ContentWatchList>()
                },
                new Item()
                {
                    ItemId = 3,
                    Moniker = "Item Four",
                    Note = "Note Four",
                    ContentsWatchLists = new List<ContentWatchList>()
                }
            };
 
            ContentWatchListCollection = new ObservableCollection<ContentWatchList>
            {
                new ContentWatchList()
                {
                    ContentWatchListId = 0,
                    ParentWatchList = WatchListsCollection.First(p=>p.WatchListId==0),
                    ItemItem = ItemsCollection.First(p=>p.ItemId==0)
                },
 
                new ContentWatchList()
                {
                    ContentWatchListId = 1,
                    ParentWatchList = WatchListsCollection.First(p=>p.WatchListId==0),
                    ItemItem = ItemsCollection.First(p=>p.ItemId==1)
                },
 
                new ContentWatchList()
                {
                    ContentWatchListId = 2,
                    ParentWatchList = WatchListsCollection.First(p=>p.WatchListId==0),
                    ItemItem = ItemsCollection.First(p=>p.ItemId==2)
                },
 
                new ContentWatchList()
                {
                    ContentWatchListId = 3,
                    ParentWatchList = WatchListsCollection.First(p=>p.WatchListId==1),
                    ItemItem = ItemsCollection.First(p=>p.ItemId==3)
                },
 
                new ContentWatchList()
                {
                    ContentWatchListId = 4,
                    ParentWatchList = WatchListsCollection.First(p=>p.WatchListId==1),
                    ItemItem = ItemsCollection.First(p=>p.ItemId==2)
                },
 
                new ContentWatchList()
                {
                    ContentWatchListId = 5,
                    ParentWatchList = WatchListsCollection.First(p=>p.WatchListId==1),
                    ItemItem = ItemsCollection.First(p=>p.ItemId==1)
                }
            };
 
            foreach (var item in ItemsCollection)
            {
                foreach (var content in ContentWatchListCollection)
                {
                    if (item.ItemId == content.ItemItem.ItemId) item.ContentsWatchLists.Add(content);
                }
            }
 
            foreach (var wachlist in WatchListsCollection)
            {
                foreach (var content in ContentWatchListCollection)
                {
                    if (wachlist.WatchListId == content.ParentWatchList.WatchListId) wachlist.Content.Add(content);
                }
            }
 
             
        }
    }
}

 

There is a view: 

<Window x:Class="TelerikHierarchyChildTemplate.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <telerik:RadGridView Grid.Column="0" ItemsSource="{Binding WatchListsCollection}"></telerik:RadGridView>
            <telerik:RadGridView Grid.Column="1" ItemsSource="{Binding ContentWatchListCollection}"></telerik:RadGridView>
            <telerik:RadGridView Grid.Column="2" ItemsSource="{Binding ItemsCollection}"></telerik:RadGridView>
        </Grid>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <telerik:RadGridView ItemsSource="{Binding WatchListsCollection}">
                                <telerik:RadGridView.ChildTableDefinitions>
                                    <telerik:GridViewTableDefinition>
                                        <telerik:GridViewTableDefinition.Relation>
                                            <telerik:PropertyRelation ParentPropertyName="Content" />
                                        </telerik:GridViewTableDefinition.Relation>
                                    </telerik:GridViewTableDefinition>
                                </telerik:RadGridView.ChildTableDefinitions>
            </telerik:RadGridView>
            <telerik:RadGridView Grid.Column="1" ItemsSource="{Binding WatchListsCollection}">
                <telerik:RadGridView.ChildTableDefinitions>
                    <telerik:GridViewTableDefinition/>
                </telerik:RadGridView.ChildTableDefinitions>
 
                <telerik:RadGridView.HierarchyChildTemplate>
                    <DataTemplate>
                        <telerik:RadGridView x:Name="RadGridView1" GroupRenderMode="Flat"
                                             DataContext="{Binding}"
                                             BorderThickness="0,1,0,1"
                                             GridLinesVisibility="None"
                                             CanUserFreezeColumns="False"
                                             AutoGenerateColumns="False"
                                             ItemsSource="{Binding ContentWatchListCollection}"
                                             ShowGroupPanel="False"
                                             IsReadOnly="True">
                            <telerik:RadGridView.Columns>
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding ItemItem.Moniker}"
                                                            Header="Moniker" />
                                <telerik:GridViewDataColumn DataMemberBinding="{Binding ItemItem.Note}"
                                                            Header="Note" />
 
                            </telerik:RadGridView.Columns>
                        </telerik:RadGridView>
                    </DataTemplate>
                </telerik:RadGridView.HierarchyChildTemplate>
 
            </telerik:RadGridView>
        </Grid>
 
    </Grid>
</Window>

 

Results of work on the attached image.

A hierarchical structure is displayed when using GridViewTableDefinition.Relation, and when using HierarchyChildTemplate, there is no.

I ask you to inform me that it is necessary to correct that the nested data began to be displayed at usage HierarchyChildTemplate

 

Dinko | Tech Support Engineer
Telerik team
 answered on 21 Aug 2017
2 answers
439 views

I have created a simple project to test RadDocking. My Xaml is pretty basic(exactly what's given in the examplehttp://docs.telerik.com/devtools/wpf/controls/raddocking/features/panes/docked-floating-panes). But I cannot see the controls in the designer and also when I execute the code nothing appears on the window.

<Window x:Class="DockTest.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:local="clr-namespace:DockTest"xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"mc:Ignorable="d"Title="MainWindow" Height="350" Width="525"><Grid><telerik:RadDocking x:Name="radDocking"><telerik:RadSplitContainer x:Name="radSplitContainer" InitialPosition="DockedRight"><telerik:RadPaneGroup x:Name="radPaneGroup"><telerik:RadPane x:Name="radPane" Header="Docked Pane"><TextBlock Text="Docked Pane."></TextBlock></telerik:RadPane></telerik:RadPaneGroup></telerik:RadSplitContainer></telerik:RadDocking></Grid>

I have included all the required dlls:
Telerik.Windows.Controls
Telerik.Windows.Controls.Navigation
Telerik.Windows.Controls.Docking
Telerik.Windows.Data
I get no error on design or runtime. The version of my Dlls is "2016.1.216.45". My project is running with .Net Framework 4.6.

F1Soft
Top achievements
Rank 1
 answered on 18 Aug 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
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?