This is a migrated thread and some comments may be shown as answers.

[Solved] set transparent background

2 Answers 329 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
neo e
Top achievements
Rank 1
neo e asked on 08 Dec 2010, 08:02 PM
hi I tried to set the background to transparent, but not working. I tried to set the row background to transparent as well. but doesn't work either.
the following xaml showing transparent background at design time but not at runtime, however the transparent background works for the listbox.

UserControl x:Class="SilverlightApplication1.MainPage"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:local="clr-namespace:SilverlightApplication1" mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <UserControl.Resources>
        <local:MyDataContext x:Key="context"/>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" DataContext="{StaticResource context}" Background="LightBlue">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="200" />
        </Grid.ColumnDefinitions>
        <telerik:RadGridView ItemsSource="{Binding Data}" SelectionMode="Extended" SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                             Background="Transparent" RowActivated="RadGridView_RowActivated">
            <i:Interaction.Behaviors>
                <local:MyMultiSelectBehavior SelectedItems="{Binding SelectedItems, Source={StaticResource context}}" />
            </i:Interaction.Behaviors>
        </telerik:RadGridView>
        <StackPanel Orientation="Vertical" Grid.Column="1">
            <telerik:RadButton Content="Clear selected items" Click="Button_Click" />
            <TextBlock Text="Selected items:"/>
            <ListBox ItemsSource="{Binding SelectedItems}" DisplayMemberPath="ID" Background="Transparent" />
        </StackPanel>
    </Grid>
</UserControl>

2 Answers, 1 is accepted

Sort by
0
Timothy
Top achievements
Rank 1
answered on 09 Dec 2010, 01:15 AM
Try using the transparent theme on the gridview,

telerik

 

 

:StyleManager.Theme="Transparent"

 

Make sure you import the assembly as well.

0
Accepted
Vanya Pavlova
Telerik team
answered on 09 Dec 2010, 09:44 AM
Hello neo e,


The structure of RadGridView follows quite different logic from the one that ListBox control uses. If you need to have completely transparent GridView the easiest way to achieve this result is to set its Background to Transparent and create an implicit style targeted at GridViewRow.
Please use the following markup:

<Grid x:Name="LayoutRoot" Background="LightBlue" DataContext="{Binding Source={StaticResource SampleDataSource}}">
    <telerik:RadGridView Background="Transparent" RowIndicatorVisibility="Collapsed" Margin="72,72,63,54" AutoGenerateColumns="False" ItemsSource="{Binding Collection}">
        <telerik:RadGridView.RowStyle>
            <Style TargetType="telerik:GridViewRow">
                <Setter Property="Background" Value="Transparent"/>
           </Style>
      </telerik:RadGridView.RowStyle>
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn Header="P1" DataMemberBinding="{Binding Property1}"/> 
                <telerik:GridViewDataColumn Header="P2" DataMemberBinding="{Binding Property2}"/>
                <telerik:GridViewDataColumn Header="P3" DataMemberBinding="{Binding Property3}"/>
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
</Grid>


Best wishes,
Vanya Pavlova
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
GridView
Asked by
neo e
Top achievements
Rank 1
Answers by
Timothy
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or