Telerik Forums
UI for WPF Forum
3 answers
239 views
Does the TabControl.ItemsSource property support CompositeCollection?


<
TabControl>
    <TabControl.ItemsSource>
        <CompositeCollection>
            <TabItem Header="Extra Tab" />
            <CollectionContainer Collection="{Binding Items}" />
        </CompositeCollection>
    </TabControl.ItemsSource>
</TabControl>>
Petar Mladenov
Telerik team
 answered on 25 May 2011
1 answer
180 views
Hello,

I am trying to style the RadMap, and within that, I am trying to style the PART_MapCommandBar and PART_MapZoomBar which are the button which contains the options to change the type of view (RoadView, AerialView, BirdsEyeView), and whether the labels should be shown or not, and the button which contains the options to change the zoom level (World, Country, Region, Neighborhood). I obtained the styles of these components using Object -> Edit Style options, but after the styling, the commands of the buttons no longer work. Could you help me out as to what could be the issue and how to solve it?

The styles generated are as follows: 

For the Map Zoom Bar:

  <Style x:Key="MapZoomBarStyle1" TargetType="{x:Type telerik:MapZoomBar}">
 <Setter Property="Template">
  <Setter.Value>
   <ControlTemplate TargetType="{x:Type telerik:MapZoomBar}">
    <Grid x:Name="mapNavigation" Background="Transparent">
     <telerik:RadDropDownButton x:Name="PART_MapNavigationDropDown" ClickMode="Hover" Grid.Column="1" CloseOnEscape="True" DropDownIndicatorVisibility="Collapsed" DropDownPlacement="Top" DropDownHeight="200">
      <telerik:RadDropDownButton.DropDownContent>
       <Grid x:Name="PART_DropDownPopupWrapper" Background="#01FFFFFF" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Border BorderBrush="Transparent" BorderThickness="1,1,1,0" Background="Transparent" CornerRadius="3" HorizontalAlignment="Left" Width="42">
         <Border BorderBrush="#FFADADAC" BorderThickness="1" CornerRadius="2" Margin="1,0">
          <Border.Background>
           <LinearGradientBrush EndPoint="1.489,0.798" StartPoint="-0.68,0.083">
            <GradientStop Color="#B2000000" Offset="0.146"/>
            <GradientStop Color="#DA353535" Offset="1"/>
            <GradientStop Color="#CCBBB6B6" Offset="0.28"/>
            <GradientStop Color="#CBD8D8D8" Offset="0.74"/>
           </LinearGradientBrush>
          </Border.Background>
         </Border>
        </Border>
        <telerik:RadSlider x:Name="PART_ZoomSlider" Grid.ColumnSpan="2" HorizontalAlignment="Left" Maximum="20" Margin="8,0,0,0" Minimum="1" VerticalAlignment="Stretch">
         <telerik:RadSlider.Style>
          <Style TargetType="{x:Type telerik:RadSlider}">
           <Setter Property="Orientation" Value="Vertical"/>
           <Setter Property="IsEnabled" Value="True"/>
           <Setter Property="HandlesVisibility" Value="Visible"/>
           <Setter Property="IsMouseWheelEnabled" Value="True"/>
           <Setter Property="Background">
            <Setter.Value>
             <LinearGradientBrush EndPoint="1.027,0.951" StartPoint="0.084,0.951">
              <GradientStop Color="#FF141414"/>
              <GradientStop Color="#FF969696" Offset="1"/>
              <GradientStop Color="#FF343434" Offset="0.5"/>
             </LinearGradientBrush>
            </Setter.Value>
           </Setter>
           <Setter Property="BorderBrush" Value="Transparent"/>
           <Setter Property="Delay" Value="250"/>
           <Setter Property="RepeatInterval" Value="250"/>
           <Setter Property="StepAction" Value="ChangeRange"/>
           <Setter Property="ThumbVisibility" Value="Visible"/>
           <Setter Property="SelectionStart" Value="0.4"/>
           <Setter Property="SelectionEnd" Value="0.6"/>
           <Setter Property="MinimumRangeSpan" Value="0"/>
           <Setter Property="IsSnapToTickEnabled" Value="True"/>
           <Setter Property="TickPlacement" Value="None"/>
           <Setter Property="TickFrequency" Value="1"/>
           <Setter Property="Template">
            <Setter.Value>
             <ControlTemplate TargetType="{x:Type telerik:RadSlider}">
              <Grid x:Name="LayoutRoot">
               <Grid.Resources>
                <DataTemplate x:Key="VerticalTickTemplate">
                 <Grid x:Name="RootElement" ToolTip="{Binding}">
                  <Rectangle Fill="Black" Height="1" Width="6"/>
                  <Rectangle Fill="#99FFFFFF" Height="1" Margin="0,1,0,0" Width="6"/>
                 </Grid>
                </DataTemplate>
               </Grid.Resources>
               <Grid>
                <Grid x:Name="VerticalTemplate">
                 <Grid.ColumnDefinitions>
                  <ColumnDefinition Width="Auto"/>
                  <ColumnDefinition Width="Auto"/>
                  <ColumnDefinition Width="Auto"/>
                 </Grid.ColumnDefinitions>
                 <Grid.RowDefinitions>
                  <RowDefinition Height="Auto"/>
                  <RowDefinition Height="*"/>
                  <RowDefinition Height="Auto"/>
                 </Grid.RowDefinitions>
                 <telerik:RadTickBar x:Name="LeftTickBar" Grid.Column="0" EnableSideTicks="{TemplateBinding EnableSideTicks}" IsTabStop="False" IsDirectionReversed="{TemplateBinding IsDirectionReversed}" Maximum="{TemplateBinding Maximum}" MinWidth="6" Minimum="{TemplateBinding Minimum}" Orientation="{TemplateBinding Orientation}" Placement="Left" Grid.Row="1" Ticks="{TemplateBinding Ticks}" TickTemplateSelector="{TemplateBinding TickTemplateSelector}" TickTemplate="{TemplateBinding TickTemplate}" TickFrequency="{TemplateBinding TickFrequency}">
                  <telerik:RadTickBar.Template>
                   <ControlTemplate TargetType="{x:Type telerik:RadTickBar}">
                    <Canvas x:Name="LayoutRoot" Background="Transparent"/>
                   </ControlTemplate>
                  </telerik:RadTickBar.Template>
                 </telerik:RadTickBar>
                 <telerik:RadTickBar x:Name="RightTickBar" Grid.Column="2" EnableSideTicks="{TemplateBinding EnableSideTicks}" IsTabStop="False" IsDirectionReversed="{TemplateBinding IsDirectionReversed}" Maximum="{TemplateBinding Maximum}" MinWidth="6" Minimum="{TemplateBinding Minimum}" Orientation="{TemplateBinding Orientation}" Placement="Right" Grid.Row="1" Ticks="{TemplateBinding Ticks}" TickTemplateSelector="{TemplateBinding TickTemplateSelector}" TickTemplate="{TemplateBinding TickTemplate}" TickFrequency="{TemplateBinding TickFrequency}">
                  <telerik:RadTickBar.Template>
                   <ControlTemplate TargetType="{x:Type telerik:RadTickBar}">
                    <Canvas x:Name="LayoutRoot" Background="Transparent"/>
                   </ControlTemplate>
                  </telerik:RadTickBar.Template>
                 </telerik:RadTickBar>
                 <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" Grid.Column="1" CornerRadius="0" HorizontalAlignment="Center" Grid.Row="1" Width="6">
                  <Border BorderBrush="#FFADADAC" BorderThickness="1,1,0,1" Background="{TemplateBinding Background}" CornerRadius="0"/>
                 </Border>
                 <Grid x:Name="VerticalSingleThumbTemplate" Grid.Column="1" Grid.Row="1">
                  <Grid.RowDefinitions>
                   <RowDefinition Height="*"/>
                   <RowDefinition Height="Auto"/>
                   <RowDefinition Height="Auto"/>
                  </Grid.RowDefinitions>
                  <Rectangle x:Name="VerticalSingleLargeDecrease" Cursor="Hand" Fill="Transparent" HorizontalAlignment="Stretch" Opacity="0" Grid.Row="2"/>
                  <Thumb x:Name="VerticalSingleThumb" HorizontalAlignment="Center" Height="10" IsEnabled="{TemplateBinding IsEnabled}" Grid.Row="1" Visibility="{TemplateBinding ThumbVisibility}" Width="20">
                   <Thumb.Template>
                    <ControlTemplate TargetType="{x:Type Thumb}">
                     <Grid>
                      <Border x:Name="Border" BorderThickness="1" Background="#FF575859" CornerRadius="3">
                       <Border.BorderBrush>
                        <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
                         <GradientStop Color="#FF707070" Offset="0"/>
                         <GradientStop Color="#FF707070" Offset="1"/>
                         <GradientStop Color="#FFA3A3A3" Offset="0.5"/>
                         <GradientStop Color="#FF707070" Offset="1"/>
                        </LinearGradientBrush>
                       </Border.BorderBrush>
                       <Border x:Name="InnerBorder" BorderBrush="Transparent" BorderThickness="1" CornerRadius="0"/>
                      </Border>
                     </Grid>
                     <ControlTemplate.Triggers>
                      <Trigger Property="IsMouseOver" Value="True">
                       <Setter Property="BorderBrush" TargetName="Border">
                        <Setter.Value>
                         <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
                          <GradientStop Color="#FFB0B0B0" Offset="0"/>
                          <GradientStop Color="#FFB0B0B0" Offset="1"/>
                          <GradientStop Color="#FFE0E1E2" Offset="0.5"/>
                         </LinearGradientBrush>
                        </Setter.Value>
                       </Setter>
                       <Setter Property="BorderBrush" TargetName="InnerBorder" Value="Transparent"/>
                       <Setter Property="Background" TargetName="Border" Value="#FF878787"/>
                      </Trigger>
                      <Trigger Property="IsEnabled" Value="False">
                       <Setter Property="BorderBrush" TargetName="Border" Value="#FF5D5C5C"/>
                       <Setter Property="BorderBrush" TargetName="InnerBorder" Value="Transparent"/>
                       <Setter Property="Background" TargetName="Border" Value="#FF666666"/>
                      </Trigger>
                      <Trigger Property="IsDragging" Value="True">
                       <Setter Property="BorderBrush" TargetName="Border" Value="#FF1A1A1A"/>
                       <Setter Property="BorderBrush" TargetName="InnerBorder" Value="Transparent"/>
                       <Setter Property="Background" TargetName="Border">
                        <Setter.Value>
                         <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                          <GradientStop Color="#FF2E2D2D" Offset="0"/>
                          <GradientStop Color="#FF424242" Offset="1"/>
                          <GradientStop Color="#FF424242" Offset="0.14"/>
                         </LinearGradientBrush>
                        </Setter.Value>
                       </Setter>
                      </Trigger>
                     </ControlTemplate.Triggers>
                    </ControlTemplate>
                   </Thumb.Template>
                  </Thumb>
                  <Rectangle x:Name="VerticalSingleLargeIncrease" Cursor="Hand" Fill="Transparent" HorizontalAlignment="Stretch" Opacity="0" Grid.Row="0"/>
                 </Grid>
                 <RepeatButton x:Name="VerticalDecreaseHandle" Grid.Column="1" Delay="{TemplateBinding Delay}" HorizontalAlignment="Center" IsEnabled="{TemplateBinding IsEnabled}" Interval="{TemplateBinding RepeatInterval}" Opacity="0.8" Grid.Row="2" RenderTransformOrigin="0.5,0.5" Visibility="{TemplateBinding HandlesVisibility}">
                  <RepeatButton.RenderTransform>
                   <TransformGroup>
                    <ScaleTransform ScaleY="-1" ScaleX="-1"/>
                    <RotateTransform Angle="90"/>
                   </TransformGroup>
                  </RepeatButton.RenderTransform>
                  <RepeatButton.Style>
                   <Style TargetType="{x:Type RepeatButton}">
                    <Setter Property="IsTabStop" Value="False"/>
                    <Setter Property="Cursor" Value="Hand"/>
                    <Setter Property="Template">
                     <Setter.Value>
                      <ControlTemplate TargetType="{x:Type RepeatButton}">
                       <Grid x:Name="Root" Height="22" Margin="2,5" Width="22">
                        <Border x:Name="Border" BorderThickness="1" Background="#FF575859" CornerRadius="3">
                         <Border.BorderBrush>
                          <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
                           <GradientStop Color="#FF707070" Offset="0"/>
                           <GradientStop Color="#FFA3A3A3" Offset="0.5"/>
                           <GradientStop Color="#FF707070" Offset="1"/>
                          </LinearGradientBrush>
                         </Border.BorderBrush>
                         <Border x:Name="InnerBorder" BorderBrush="Transparent" BorderThickness="1" CornerRadius="2"/>
                        </Border>
                        <Telerik_Windows_Controls_Chromes:ButtonChrome CornerRadius="3" Orientation="Vertical" RenderNormal="False" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}" RenderFocused="{TemplateBinding IsFocused}" RenderEnabled="{TemplateBinding IsEnabled}">
                         <telerik:StyleManager.Theme>
                          <telerik:Expression_DarkTheme/>
                         </telerik:StyleManager.Theme>
                        </Telerik_Windows_Controls_Chromes:ButtonChrome>
                        <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}"/>
                       </Grid>
                      </ControlTemplate>
                     </Setter.Value>
                    </Setter>
                   </Style>
                  </RepeatButton.Style>
                  <Path Data="M1.48956,16.175882L7.1873875,16.175882 7.1873875,18.47793 1.48956,18.47793z" Fill="#FFC5C2C2" HorizontalAlignment="Center" Height="9" Stretch="Fill" VerticalAlignment="Center" Width="2"/>
                 </RepeatButton>
                 <RepeatButton x:Name="VerticalIncreaseHandle" Grid.Column="1" Delay="{TemplateBinding Delay}" HorizontalAlignment="Center" IsEnabled="{TemplateBinding IsEnabled}" Interval="{TemplateBinding RepeatInterval}" Opacity="0.8" Grid.Row="0" RenderTransformOrigin="0.5,0.5" Visibility="{TemplateBinding HandlesVisibility}">
                  <RepeatButton.RenderTransform>
                   <TransformGroup>
                    <ScaleTransform ScaleY="-1" ScaleX="1"/>
                    <RotateTransform Angle="90"/>
                   </TransformGroup>
                  </RepeatButton.RenderTransform>
                  <RepeatButton.Style>
                   <Style TargetType="{x:Type RepeatButton}">
                    <Setter Property="IsTabStop" Value="False"/>
                    <Setter Property="Cursor" Value="Hand"/>
                    <Setter Property="Template">
                     <Setter.Value>
                      <ControlTemplate TargetType="{x:Type RepeatButton}">
                       <Grid x:Name="Root" Height="22" Margin="2,5" Width="22">
                        <Border x:Name="Border" BorderThickness="1" Background="#FF575859" CornerRadius="3">
                         <Border.BorderBrush>
                          <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
                           <GradientStop Color="#FF707070" Offset="0"/>
                           <GradientStop Color="#FFA3A3A3" Offset="0.5"/>
                           <GradientStop Color="#FF707070" Offset="1"/>
                          </LinearGradientBrush>
                         </Border.BorderBrush>
                         <Border x:Name="InnerBorder" BorderBrush="Transparent" BorderThickness="1" CornerRadius="2"/>
                        </Border>
                        <Telerik_Windows_Controls_Chromes:ButtonChrome CornerRadius="3" Orientation="Vertical" RenderNormal="False" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}" RenderFocused="{TemplateBinding IsFocused}" RenderEnabled="{TemplateBinding IsEnabled}">
                         <telerik:StyleManager.Theme>
                          <telerik:Expression_DarkTheme/>
                         </telerik:StyleManager.Theme>
                        </Telerik_Windows_Controls_Chromes:ButtonChrome>
                        <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}"/>
                       </Grid>
                      </ControlTemplate>
                     </Setter.Value>
                    </Setter>
                   </Style>
                  </RepeatButton.Style>
                  <Path Data="M4.0009999,0L6.0009999,0 6.0009999,3.9619999 10,3.9619999 10,5.9619999 6.0009999,5.9619999 6.0009999,10 4.0009999,10 4.0009999,5.9619999 0,5.9619999 0,3.9619999 4.0009999,3.9619999z" Fill="#FFC5C2C2" HorizontalAlignment="Center" Height="9" Stretch="Fill" VerticalAlignment="Center" Width="9"/>
                 </RepeatButton>
                </Grid>
               </Grid>
               <Rectangle x:Name="FocusVisual" Opacity="0" RadiusY="2" RadiusX="2" Stroke="Black" StrokeThickness="1" StrokeDashArray="1 2"/>
              </Grid>
             </ControlTemplate>
            </Setter.Value>
           </Setter>
          </Style>
         </telerik:RadSlider.Style>
        </telerik:RadSlider>
        <StackPanel x:Name="PART_ZoomPresetsPanel" Grid.ColumnSpan="2" Grid.Column="1" HorizontalAlignment="Left" Margin="35,0,0,0" VerticalAlignment="Center">
         <telerik:RadButton Background="#E5575859" Content="Neighborhood" CornerRadius="3" FontWeight="Bold" FontSize="11" Height="24" Margin="0,1" Opacity="1" Padding="7,0" telerik:LocalizationManager.ResourceKey="MapPresetZoomLevelNeighborhood" Tag="NeighborhoodLevel">
          <telerik:RadButton.BorderBrush>
           <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
            <GradientStop Color="#FF707070" Offset="0"/>
            <GradientStop Color="#FF707070" Offset="1"/>
            <GradientStop Color="#FFA3A3A3" Offset="0.5"/>
            <GradientStop Color="#FF707070" Offset="1"/>
           </LinearGradientBrush>
          </telerik:RadButton.BorderBrush>
          <telerik:StyleManager.Theme>
           <telerik:Expression_DarkTheme/>
          </telerik:StyleManager.Theme>
         </telerik:RadButton>
         <telerik:RadButton Background="#E5575859" Content="City" CornerRadius="3" FontWeight="Bold" FontSize="11" Height="24" Margin="0,1" Opacity="1" Padding="7,0" telerik:LocalizationManager.ResourceKey="MapPresetZoomLevelCity" Tag="CityLevel">
          <telerik:RadButton.BorderBrush>
           <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
            <GradientStop Color="#FF707070" Offset="0"/>
            <GradientStop Color="#FF707070" Offset="1"/>
            <GradientStop Color="#FFA3A3A3" Offset="0.5"/>
            <GradientStop Color="#FF707070" Offset="1"/>
           </LinearGradientBrush>
          </telerik:RadButton.BorderBrush>
          <telerik:StyleManager.Theme>
           <telerik:Expression_DarkTheme/>
          </telerik:StyleManager.Theme>
         </telerik:RadButton>
         <telerik:RadButton Background="#E5575859" Content="Region" CornerRadius="3" FontWeight="Bold" FontSize="11" Height="24" Margin="0,1" Opacity="1" Padding="7,0" telerik:LocalizationManager.ResourceKey="MapPresetZoomLevelRegion" Tag="RegionLevel">
          <telerik:RadButton.BorderBrush>
           <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
            <GradientStop Color="#FF707070" Offset="0"/>
            <GradientStop Color="#FF707070" Offset="1"/>
            <GradientStop Color="#FFA3A3A3" Offset="0.5"/>
            <GradientStop Color="#FF707070" Offset="1"/>
           </LinearGradientBrush>
          </telerik:RadButton.BorderBrush>
          <telerik:StyleManager.Theme>
           <telerik:Expression_DarkTheme/>
          </telerik:StyleManager.Theme>
         </telerik:RadButton>
         <telerik:RadButton Background="#E5575859" Content="State" CornerRadius="3" FontWeight="Bold" FontSize="11" Height="24" Margin="0,1" Opacity="1" Padding="10,0" telerik:LocalizationManager.ResourceKey="MapPresetZoomLevelState" Tag="StateLevel">
          <telerik:RadButton.BorderBrush>
           <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
            <GradientStop Color="#FF707070" Offset="0"/>
            <GradientStop Color="#FF707070" Offset="1"/>
            <GradientStop Color="#FFA3A3A3" Offset="0.5"/>
            <GradientStop Color="#FF707070" Offset="1"/>
           </LinearGradientBrush>
          </telerik:RadButton.BorderBrush>
          <telerik:StyleManager.Theme>
           <telerik:Expression_DarkTheme/>
          </telerik:StyleManager.Theme>
         </telerik:RadButton>
         <telerik:RadButton Background="#E5575859" Content="World" CornerRadius="3" FontWeight="Bold" FontSize="11" Height="24" Margin="0,1" Opacity="1" Padding="7,0" telerik:LocalizationManager.ResourceKey="MapPresetZoomLevelWorld" Tag="WorldLevel">
          <telerik:RadButton.BorderBrush>
           <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
            <GradientStop Color="#FF707070" Offset="0"/>
            <GradientStop Color="#FF707070" Offset="1"/>
            <GradientStop Color="#FFA3A3A3" Offset="0.5"/>
            <GradientStop Color="#FF707070" Offset="1"/>
           </LinearGradientBrush>
          </telerik:RadButton.BorderBrush>
          <telerik:StyleManager.Theme>
           <telerik:Expression_DarkTheme/>
          </telerik:StyleManager.Theme>
         </telerik:RadButton>
        </StackPanel>
       </Grid>
      </telerik:RadDropDownButton.DropDownContent>
      <telerik:RadDropDownButton.Style>
       <Style TargetType="{x:Type telerik:RadDropDownButton}">
        <Setter Property="Background">
         <Setter.Value>
          <LinearGradientBrush EndPoint="0.801,0.765" StartPoint="0.199,0.235">
           <GradientStop Color="#D86C6C6C" Offset="1"/>
           <GradientStop Color="#CC101010"/>
           <GradientStop Color="#D8646363" Offset="0.28"/>
           <GradientStop Color="#FF7C7B7B" Offset="0.741"/>
          </LinearGradientBrush>
         </Setter.Value>
        </Setter>
        <Setter Property="Template">
         <Setter.Value>
          <ControlTemplate TargetType="{x:Type telerik:RadDropDownButton}">
           <Grid SnapsToDevicePixels="True">
            <Path x:Name="Border" Data="M3.000001,0C3.000001,0 36.831249,6.1663559E-07 36.982265,7.0035469E-07 38.91526,6.1663559E-07 43.278763,6.268014 43.278763,14 43.278763,21.731987 38.91526,28 36.982265,28 36.831249,28 3.000001,28 3.000001,28 3.000001,28 5.3613954,21.007113 5.3613954,14 5.3613954,6.9928875 3.000001,0 3.000001,0z" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1"/>
            <Grid>
             <Grid.ColumnDefinitions>
              <ColumnDefinition Width="Auto"/>
              <ColumnDefinition Width="*"/>
              <ColumnDefinition Width="Auto"/>
             </Grid.ColumnDefinitions>
             <Grid.RowDefinitions>
              <RowDefinition Height="Auto"/>
              <RowDefinition Height="*"/>
              <RowDefinition Height="Auto"/>
             </Grid.RowDefinitions>
             <ContentPresenter x:Name="Content" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Grid.Row="1" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
            </Grid>
            <Popup x:Name="DropDownPopup" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" StaysOpen="False">
             <Grid>
              <Border x:Name="DropDownPopupBorder" CornerRadius="{TemplateBinding CornerRadius}" Height="{TemplateBinding DropDownHeight}" MaxWidth="{TemplateBinding DropDownMaxWidth}" MaxHeight="{TemplateBinding DropDownMaxHeight}" Margin="0,1,4,4" MinWidth="3" MinHeight="3" Width="{TemplateBinding DropDownWidth}">
               <ContentPresenter x:Name="DropDownPopupContent" ContentTemplate="{TemplateBinding DropDownContentTemplate}" Content="{TemplateBinding DropDownContent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
              </Border>
             </Grid>
            </Popup>
           </Grid>
           <ControlTemplate.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
             <Setter Property="Fill" TargetName="Border" Value="#CC878787"/>
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
             <Setter Property="Fill" TargetName="Border" Value="#CC878787"/>
            </Trigger>
            <Trigger Property="IsOpen" Value="True"/>
            <Trigger Property="DropDownPlacement" Value="Top">
             <Setter Property="Placement" TargetName="DropDownPopup" Value="Top"/>
            </Trigger>
           </ControlTemplate.Triggers>
          </ControlTemplate>
         </Setter.Value>
        </Setter>
        <Style.BasedOn>
         <Style TargetType="{x:Type telerik:RadDropDownButton}">
          <Setter Property="Width" Value="44"/>
          <Setter Property="Height" Value="28"/>
          <Setter Property="BorderBrush" Value="#FFADADAC"/>
          <Setter Property="Padding" Value="0"/>
         </Style>
        </Style.BasedOn>
       </Style>
      </telerik:RadDropDownButton.Style>
      <telerik:StyleManager.Theme>
       <telerik:Expression_DarkTheme/>
      </telerik:StyleManager.Theme>
      <Grid>
       <Path Data="M13.952573,12.273359L21.023642,19.588496 19.609426,21.00271 12.53836,13.687573z M8,1C11.865993,1.0000001 15,4.1340071 15,8.0000001 15,11.865994 11.865993,15 8,15 4.134007,15 1,11.865994 1,8.0000001 1,4.1340071 4.134007,1.0000001 8,1z" Height="19" Stretch="Fill" StrokeThickness="2" Width="19">
        <Path.Effect>
         <DropShadowEffect BlurRadius="3" Color="White" ShadowDepth="0"/>
        </Path.Effect>
        <Path.Fill>
         <LinearGradientBrush EndPoint="0.48,0.972" StartPoint="0.47,-0.171">
          <GradientStop Color="#D1FFFFFF"/>
          <GradientStop Color="#EBFFFFFF" Offset="0.897"/>
         </LinearGradientBrush>
        </Path.Fill>
        <Path.Stroke>
         <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
          <GradientStop Color="Gray"/>
          <GradientStop Color="Black" Offset="1"/>
         </LinearGradientBrush>
        </Path.Stroke>
       </Path>
       <Ellipse HorizontalAlignment="Left" Height="6" Margin="4,4,0,0" VerticalAlignment="Top" Width="6">
        <Ellipse.Fill>
         <LinearGradientBrush EndPoint="0.483999997377396,1.307000041008" StartPoint="0.462000012397766,-0.104000002145767">
          <GradientStop Color="#FF1F5A83" Offset="0"/>
          <GradientStop Color="#E5000000" Offset="1"/>
         </LinearGradientBrush>
        </Ellipse.Fill>
       </Ellipse>
      </Grid>
     </telerik:RadDropDownButton>
    </Grid>
   </ControlTemplate>
  </Setter.Value>
 </Setter>
</Style>

For the Map Command Bar:

<Style x:Key="MapCommandBarStyle1" TargetType="{x:Type telerik:MapCommandBar}">
 <Setter Property="Template">
  <Setter.Value>
   <ControlTemplate TargetType="{x:Type telerik:MapCommandBar}">
    <telerik:RadDropDownButton x:Name="PART_MapCommandDropDown" ClickMode="Hover" CloseOnEscape="True" DropDownIndicatorVisibility="Collapsed" DropDownPlacement="Top">
     <telerik:RadDropDownButton.DropDownContent>
      <Grid x:Name="PART_DropDownPopupWrapper" Background="#01FFFFFF" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
       <Border BorderBrush="Transparent" BorderThickness="1,1,1,0" Background="Transparent" CornerRadius="3" HorizontalAlignment="Right" Width="42">
        <Border BorderBrush="#FFADADAC" BorderThickness="1" CornerRadius="2" Margin="1,0">
         <Border.Background>
          <LinearGradientBrush EndPoint="1.489,0.798" StartPoint="-0.68,0.083">
           <GradientStop Color="#B2000000" Offset="0.146"/>
           <GradientStop Color="#DA353535" Offset="1"/>
           <GradientStop Color="#CCBBB6B6" Offset="0.28"/>
           <GradientStop Color="#CBD8D8D8" Offset="0.74"/>
          </LinearGradientBrush>
         </Border.Background>
        </Border>
       </Border>
       <StackPanel HorizontalAlignment="Left" Margin="0,5,5,5" VerticalAlignment="Center">
        <telerik:RadRadioButton x:Name="PART_MapStyle_Road" Background="#E5575859" CornerRadius="3" HorizontalContentAlignment="Stretch" Height="26" Margin="0,2" Opacity="1" Tag="Road">
         <telerik:RadRadioButton.BorderBrush>
          <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
           <GradientStop Color="#FF707070" Offset="0"/>
           <GradientStop Color="#FF707070" Offset="1"/>
           <GradientStop Color="#FFA3A3A3" Offset="0.5"/>
           <GradientStop Color="#FF707070" Offset="1"/>
          </LinearGradientBrush>
         </telerik:RadRadioButton.BorderBrush>
         <telerik:StyleManager.Theme>
          <telerik:Expression_DarkTheme/>
         </telerik:StyleManager.Theme>
         <Grid HorizontalAlignment="Stretch">
          <Grid.ColumnDefinitions>
           <ColumnDefinition/>
           <ColumnDefinition Width="32"/>
          </Grid.ColumnDefinitions>
          <TextBlock FontWeight="Bold" FontSize="11" HorizontalAlignment="Stretch" Padding="7,0" telerik:LocalizationManager.ResourceKey="MapRoadCommand" TextAlignment="Center" Text="Road View"><Run Text="Road View"/></TextBlock>
          <Image Grid.Column="1" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Width="16">
           <Image.Source>
            <BitmapImage BaseUri="pack://application:,,,/Telerik.Windows.Controls.DataVisualization;Component/Themes/Map/ExpressionDark/Styles.xaml" UriSource="/Telerik.Windows.Controls.DataVisualization;component/themes/map/road.png"/>
           </Image.Source>
          </Image>
         </Grid>
        </telerik:RadRadioButton>
        <telerik:RadRadioButton x:Name="PART_MapStyle_Aerial" Background="#E5575859" CornerRadius="3" HorizontalContentAlignment="Stretch" Height="26" Margin="0,2" Opacity="1" Tag="Aerial">
         <telerik:RadRadioButton.BorderBrush>
          <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
           <GradientStop Color="#FF707070" Offset="0"/>
           <GradientStop Color="#FF707070" Offset="1"/>
           <GradientStop Color="#FFA3A3A3" Offset="0.5"/>
           <GradientStop Color="#FF707070" Offset="1"/>
          </LinearGradientBrush>
         </telerik:RadRadioButton.BorderBrush>
         <telerik:StyleManager.Theme>
          <telerik:Expression_DarkTheme/>
         </telerik:StyleManager.Theme>
         <Grid HorizontalAlignment="Stretch">
          <Grid.ColumnDefinitions>
           <ColumnDefinition/>
           <ColumnDefinition Width="32"/>
          </Grid.ColumnDefinitions>
          <TextBlock FontWeight="Bold" FontSize="11" HorizontalAlignment="Stretch" Padding="7,0" telerik:LocalizationManager.ResourceKey="MapAerialCommand" TextAlignment="Center" Text="Aerial View"><Run Text="Aerial View"/></TextBlock>
          <Image Grid.Column="1" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Width="16">
           <Image.Source>
            <BitmapImage BaseUri="pack://application:,,,/Telerik.Windows.Controls.DataVisualization;Component/Themes/Map/ExpressionDark/Styles.xaml" UriSource="/Telerik.Windows.Controls.DataVisualization;component/themes/map/aerial.png"/>
           </Image.Source>
          </Image>
         </Grid>
        </telerik:RadRadioButton>
        <telerik:RadRadioButton x:Name="PART_MapStyle_Birdseye" Background="#E5575859" CornerRadius="3" HorizontalContentAlignment="Stretch" Height="26" Margin="0,2" Opacity="1" Tag="Birdseye">
         <telerik:RadRadioButton.BorderBrush>
          <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
           <GradientStop Color="#FF707070" Offset="0"/>
           <GradientStop Color="#FF707070" Offset="1"/>
           <GradientStop Color="#FFA3A3A3" Offset="0.5"/>
           <GradientStop Color="#FF707070" Offset="1"/>
          </LinearGradientBrush>
         </telerik:RadRadioButton.BorderBrush>
         <telerik:StyleManager.Theme>
          <telerik:Expression_DarkTheme/>
         </telerik:StyleManager.Theme>
         <Grid HorizontalAlignment="Stretch">
          <Grid.ColumnDefinitions>
           <ColumnDefinition/>
           <ColumnDefinition Width="32"/>
          </Grid.ColumnDefinitions>
          <TextBlock FontWeight="Bold" FontSize="11" HorizontalAlignment="Stretch" Padding="7,0" telerik:LocalizationManager.ResourceKey="MapBirdseyeCommand" TextAlignment="Center" Text="Bird's Eye View"><Run Text="Bird's Eye View"/></TextBlock>
          <Image Grid.Column="1" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Width="16">
           <Image.Source>
            <BitmapImage BaseUri="pack://application:,,,/Telerik.Windows.Controls.DataVisualization;Component/Themes/Map/ExpressionDark/Styles.xaml" UriSource="/Telerik.Windows.Controls.DataVisualization;component/themes/map/birdeye.png"/>
           </Image.Source>
          </Image>
         </Grid>
        </telerik:RadRadioButton>
        <telerik:RadToggleButton x:Name="PART_IsLabelVisible" Background="#E5575859" CornerRadius="3" HorizontalContentAlignment="Stretch" Height="26" Margin="0,3" Opacity="1" Tag="Label">
         <telerik:RadToggleButton.BorderBrush>
          <LinearGradientBrush EndPoint="0.971000015735626,0.5" StartPoint="0.0399999991059303,0.5">
           <GradientStop Color="#FF707070" Offset="0"/>
           <GradientStop Color="#FF707070" Offset="1"/>
           <GradientStop Color="#FFA3A3A3" Offset="0.5"/>
           <GradientStop Color="#FF707070" Offset="1"/>
          </LinearGradientBrush>
         </telerik:RadToggleButton.BorderBrush>
         <telerik:StyleManager.Theme>
          <telerik:Expression_DarkTheme/>
         </telerik:StyleManager.Theme>
         <Grid HorizontalAlignment="Stretch">
          <Grid.ColumnDefinitions>
           <ColumnDefinition/>
           <ColumnDefinition Width="32"/>
          </Grid.ColumnDefinitions>
          <TextBlock FontWeight="Bold" FontSize="11" HorizontalAlignment="Stretch" Padding="7,0" telerik:LocalizationManager.ResourceKey="MapLabelsVisibleCommand" TextAlignment="Center" Text="Show Labels"><Run Text="Show Labels"/></TextBlock>
          <Image Grid.Column="1" HorizontalAlignment="Center" Height="16" VerticalAlignment="Center" Width="16">
           <Image.Source>
            <BitmapImage BaseUri="pack://application:,,,/Telerik.Windows.Controls.DataVisualization;Component/Themes/Map/ExpressionDark/Styles.xaml" UriSource="/Telerik.Windows.Controls.DataVisualization;component/themes/map/label.png"/>
           </Image.Source>
          </Image>
         </Grid>
        </telerik:RadToggleButton>
       </StackPanel>
      </Grid>
     </telerik:RadDropDownButton.DropDownContent>
     <telerik:RadDropDownButton.Style>
      <Style TargetType="{x:Type telerik:RadDropDownButton}">
       <Setter Property="Background">
        <Setter.Value>
         <LinearGradientBrush EndPoint="0.15,0.804" StartPoint="0.802,0.238">
          <GradientStop Color="#D86C6C6C"/>
          <GradientStop Color="#CC101010" Offset="0.93"/>
          <GradientStop Color="#D8646363" Offset="0.595"/>
          <GradientStop Color="#FF7C7B7B" Offset="0.185"/>
         </LinearGradientBrush>
        </Setter.Value>
       </Setter>
       <Setter Property="Template">
        <Setter.Value>
         <ControlTemplate TargetType="{x:Type telerik:RadDropDownButton}">
          <Grid>
           <Path x:Name="Border" Data="M3.000001,0C3.000001,0 36.831249,6.1663559E-07 36.982265,7.0035469E-07 38.91526,6.1663559E-07 43.278763,6.268014 43.278763,14 43.278763,21.731987 38.91526,28 36.982265,28 36.831249,28 3.000001,28 3.000001,28 3.000001,28 5.3613954,21.007113 5.3613954,14 5.3613954,6.9928875 3.000001,0 3.000001,0z" Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" RenderTransformOrigin="0.5,0.5" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" Width="{TemplateBinding Width}">
            <Path.RenderTransform>
             <ScaleTransform ScaleX="-1"/>
            </Path.RenderTransform>
           </Path>
           <Grid>
            <Grid.ColumnDefinitions>
             <ColumnDefinition Width="Auto"/>
             <ColumnDefinition Width="*"/>
             <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
             <RowDefinition Height="Auto"/>
             <RowDefinition Height="*"/>
             <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <ContentPresenter x:Name="Content" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Grid.Row="1" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
           </Grid>
           <Popup x:Name="DropDownPopup" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" StaysOpen="False">
            <Grid>
             <Border x:Name="DropDownPopupBorder" CornerRadius="{TemplateBinding CornerRadius}" Height="{TemplateBinding DropDownHeight}" MaxWidth="{TemplateBinding DropDownMaxWidth}" MaxHeight="{TemplateBinding DropDownMaxHeight}" Margin="0,1,4,4" MinWidth="3" MinHeight="3" Width="{TemplateBinding DropDownWidth}">
              <ContentPresenter x:Name="DropDownPopupContent" ContentTemplate="{TemplateBinding DropDownContentTemplate}" Content="{TemplateBinding DropDownContent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
             </Border>
            </Grid>
           </Popup>
          </Grid>
          <ControlTemplate.Triggers>
           <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Fill" TargetName="Border" Value="#CC878787"/>
           </Trigger>
           <Trigger Property="IsPressed" Value="True">
            <Setter Property="Fill" TargetName="Border" Value="#CC878787"/>
           </Trigger>
           <Trigger Property="IsOpen" Value="True"/>
           <Trigger Property="DropDownPlacement" Value="Top">
            <Setter Property="Placement" TargetName="DropDownPopup" Value="Top"/>
           </Trigger>
          </ControlTemplate.Triggers>
         </ControlTemplate>
        </Setter.Value>
       </Setter>
       <Style.BasedOn>
        <Style TargetType="{x:Type telerik:RadDropDownButton}">
         <Setter Property="Width" Value="44"/>
         <Setter Property="Height" Value="28"/>
         <Setter Property="BorderBrush" Value="#FFADADAC"/>
         <Setter Property="Padding" Value="0"/>
        </Style>
       </Style.BasedOn>
      </Style>
     </telerik:RadDropDownButton.Style>
     <telerik:StyleManager.Theme>
      <telerik:Expression_DarkTheme/>
     </telerik:StyleManager.Theme>
     <Grid>
      <Path Data="M23,6C23,7.545 18.075132,11 12,11 5.9248678,11 1,6.955 1,6 1,5.045 5.9248678,1 12,1 18.075132,1 23,4.455 23,6z" Fill="Transparent" Height="12" Margin="0,2,0,0" Stretch="Fill" Stroke="Transparent" StrokeThickness="0" Width="24"/>
      <Path Data="M23,6C23,7.545 18.075132,11 12,11 5.9248678,11 1,6.955 1,6 1,5.045 5.9248678,1 12,1 18.075132,1 23,4.455 23,6z" HorizontalAlignment="Center" Height="12" Stretch="Fill" Stroke="Transparent" StrokeThickness="0" VerticalAlignment="Center" Width="24">
       <Path.Fill>
        <LinearGradientBrush EndPoint="0.484,1.307" StartPoint="0.462,-0.104">
         <GradientStop Color="Gray" Offset="0"/>
         <GradientStop Color="Black" Offset="1"/>
        </LinearGradientBrush>
       </Path.Fill>
      </Path>
      <Ellipse Fill="White" HorizontalAlignment="Center" Height="13" VerticalAlignment="Center" Width="13"/>
      <Ellipse Fill="#FF1F5A83" HorizontalAlignment="Center" Height="7" StrokeThickness="1" VerticalAlignment="Center" Width="7">
       <Ellipse.Stroke>
        <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
         <GradientStop Color="Gray"/>
         <GradientStop Color="Black" Offset="1"/>
        </LinearGradientBrush>
       </Ellipse.Stroke>
      </Ellipse>
      <Ellipse Fill="White" Height="3" Margin="12,3,9,0" VerticalAlignment="Top" Width="3"/>
     </Grid>
    </telerik:RadDropDownButton>
   </ControlTemplate>
  </Setter.Value>
 </Setter>
</Style>
Andrey
Telerik team
 answered on 25 May 2011
6 answers
195 views
How can I set the style on buttons I add programatically?

I have the toolbar defined like so:
<toolbar:RadToolbarTray
HorizontalAlignment="Left"
x:Name="screenToolbar"
VerticalAlignment="Top"
telerikControls:StyleManager.Theme="Windows7" /> Then I add buttons like this:
var button = new Button();
tbar.Items.Add(button); //tbar is a toolbar object

The buttons don't pick up the style of the tray... on the 
silverlight side, I explicitly set the style of the button 
before I add it to the toolbar (app resource), but I don't 
see a way to pick up the toolbar button styles from the StyleManager...

Thanks --
Petar Mladenov
Telerik team
 answered on 25 May 2011
1 answer
57 views
Hi,

in the german resource file of the gridview are two misspellings (for the filtercontrol)

in english the values are:
"Is contained in" and "Is not contained in"
your german translation are "Enhalten" and "Ist nicht enhalten".

In both there is a "t" missing after the leading "en" --> "Enthalten" and "Ist nicht enthalten"

However, the meaning of the function is not clear with this translation.
So, my proposal for "Is contained in" is "Ist enthalten in" and for "Is not contained in" it is "Ist nicht enthalten in".

Well, will it be fixed?

Thanks.
Milan
Telerik team
 answered on 25 May 2011
1 answer
93 views
Hi,

In some of my gridview's when I click for the second time on the insertrow then rowvalidating is triggered before I commit the newrow with the enter key.
When I do the insert with the insert key  then there's no problem I cannot pinpoint this problem, any ideas?
Thanks,

Thomas

Thomas
Top achievements
Rank 1
 answered on 25 May 2011
0 answers
104 views
Hi,

I have referred  the sample( http://www.telerik.com/community/forums/wpf/gridview/can-t-use-celledittemplateselector-amp-celltemplateselector-together.aspx) for setting CellTemplate by using CellTemplateSelector.

I modified this sample to use DataTable as source instead of List<Item>(). In this case, i am not able to see any data in the second column of the Grid.

The code i have changed is:
public MainWindow()
{
InitializeComponent();
//List<Item> items = new List<Item>();
            //items.Add(new Item() { PropertyName = "Property1", PropertyType = typeof(string), PropertyValue = "blabla" });
            //items.Add(new Item() { PropertyName = "Property1", PropertyType = typeof(Visibility), PropertyValue = Visibility.Visible });

            DataTable items = new DataTable();
            items.Columns.Add("PropertyName");
            items.Columns.Add("PropertyType",typeof(Type));
            items.Columns.Add("PropertyValue");
            DataRow row1 = items.NewRow();
            row1[0] = "Property1";
            row1[1] = typeof(string);
            row1[2] = "blabla";
            items.Rows.Add(row1);
            row1 = items.NewRow();
            row1[0] = "Property1";
            row1[1] = typeof(Visibility);
            row1[2] = Visibility.Visible;
            items.Rows.Add(row1);         
this.dataGrid1.ItemsSource = items;
}

class PropertyValueDataTemplateSelector:
public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
{
           var r= item as System.Data.DataRow;
           Type value= r["PropertyType"] as Type;
           if (value == typeof(string))
                return this.TextTemplate;
            else
                return this.EnumTemplate;
}

Not able to figure out what is the issue.
Please give updated sample using DataTable as ItemSource.
Thanks for your help.

Thangalskhmi
Top achievements
Rank 1
 asked on 25 May 2011
0 answers
252 views
Hi,
I am using RadGridview which Itemsource is Observablecollection<CustomObject>
While editing particular cell, i want to change the another cell's content which is read only.
For Example:
Public class CustomObject
{
 public string Identifier{get;set;} 
 public string  DisplayName{get;set;}
}

My requirement is when i change the Identifier, need to change the "DisplayName" value.
I tried to change the "DisplayName" value in both CellValidated and CellValidating event. But not able to see the updated value in the UI.
I tried grid.Rebind() in both CellValidated and CellValidating event, the current cell (i.e Identifier) modification is getting lost and the updated DisplayName  value is shown in the UI.
How to modify the other column value based on some cell value changes and refresh the GridView?

code snippets:

    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            grid.CellValidated -= new EventHandler<Telerik.Windows.Controls.GridViewCellValidatedEventArgs>(grid_CellValidated);
            grid.CellValidated += new EventHandler<Telerik.Windows.Controls.GridViewCellValidatedEventArgs>(grid_CellValidated);
            grid.ItemsSource = GetObservableList();         
        }      

        void grid_CellValidated(object sender, Telerik.Windows.Controls.GridViewCellValidatedEventArgs e)
        {
            Telerik.Windows.Controls.RadGridView g = e.Cell.DataColumn.Parent as Telerik.Windows.Controls.RadGridView;
            //Modify the DisplayName cell  value.
            var currentObj = e.Cell.DataContext as CustomObject;
            currentObj.DisplayName = "Test";
            var list = g.ItemsSource as ObservableCollection<CustomObject>;
            CustomObject p = list.Where(obj => obj.UniqueKey == currentObj.UniqueKey).FirstOrDefault();
            p = currentObj;
            p.DisplayName = "Test";
        }   
        private static ObservableCollection<CustomObject> GetObservableList()
        {
            ObservableCollection<CustomObject> table = new ObservableCollection<CustomObject>();
            for (int i = 0; i <= 3; i++)
            {
                CustomObject p = new CustomObject();
                p.UniqueKey = "aa" + i;
                p.Identifier = "des" + i;
                p.DisplayName = "arfea" + i;
                table.Add(p);
            }
            return table;
        }

        public class CustomObject
        {
            public CustomObject() { }
            private string _key = null;
            private string _identifier = null;
            private string _displayName = null;
            public string UniqueKey { get { return _key; } set { _key = value; } }
            public string Identifier {get { return this._identifier; } set { this._identifier = value;}}
            public string DisplayName { get { return this._displayName; } set { this._displayName = value; } }
        }
    }

XMAL:
 <Grid>
        <telerik:RadGridView  x:Name="grid" x:FieldModifier="public"  AutoGenerateColumns="False" ItemsSource="{Binding}">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding UniqueKey}" Header="UniqueKey" UniqueName="UniqueKey"  />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Identifier, Mode=TwoWay}" UniqueName="Identifier" Header="Identifier"  />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding DisplayName, Mode=OneWay}" UniqueName="DisplayName" Header="DisplayName" IsReadOnly="True" />               
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>        
    </Grid>

Thanks,
Thanga
Thangalskhmi
Top achievements
Rank 1
 asked on 24 May 2011
24 answers
1.1K+ views
Hi,

How do I define a checkbox column in WPF GridView control?

Thanks

Miroslav
sarag
Top achievements
Rank 1
 answered on 24 May 2011
8 answers
507 views
I created a Windows WPF project and am using the RadGridView that has a child table using a TableRelation. I want to be able to hide the expand/collapse image if there are no child records. I saw an example or two that were similar to what I wanted, but populate the grid by adding records within a loop. I am assigning the ItemSource of the grid and DataSource of the GridViewTableDefinition and haven't been able to find an example of what I want that populates the grid in this way. I tried using the "PreviewDataRecordCreate" event, but it doesn't seem to fire when assigning the ItemSource. I would really like to avoid adding records by looping through the data. I looked through the API and didn't see anything obvious, but will continue to look. Have I just overlooked something or is there not a simple way to do this? Thanks.
Daryl
Top achievements
Rank 1
 answered on 24 May 2011
6 answers
186 views
Dear Sir,


I m binding the observable collection of the object having properties like attachment, isUnread , priority, id  having values either {true/False}, {true/False}, {1,2, or 3} respectively. Assuming attachment = true, isUread = false, priority = 1  , id is autoincrement .

Now when i update it from user form  : attachment = false , isUread = true, priority = 3 .... recording displayed is not update in GridView. For updating the same i need to load again and again gridview with observable collection just for 1 record i m loading 100 record or even more which not desirable. how to solve this problem.  can i only change gridview UI part. 


Thanks in advance.

Miral Shah 
Jon
Top achievements
Rank 1
 answered on 24 May 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?