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

ReadOnly Button inside RadgridView

2 Answers 189 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tiago
Top achievements
Rank 1
Tiago asked on 07 May 2012, 12:45 PM
Hi,

I have two questions, first i have a button in a column, but when a put the gridview in readonly, the button continues the same.

How i can put the button in readonly mode? This is the code.
<telerik:RadGridView x:Name="myListView" IsReadOnly="{Binding Path=pending, Converter={StaticResource booleanToInverseConv}}">
    <telerik:RadGridView.Columns>
        <telerik:GridViewColumn Header="" IsFilterable="False" HeaderCellStyle="{StaticResource estiloDaColuna}">
            <telerik:GridViewColumn.CellTemplate>
                <DataTemplate>
                    <Button Style="{DynamicResource ImageButtonStyle}" Tag="{Binding Path=id}" x:Name="btnRemoveProduto" Width="20" Click="removeProduto_Click" Height="20">
                        <Image Source="..\..\..\Icons\delete_red.png" Stretch="Fill" VerticalAlignment="Top" HorizontalAlignment="Left" />
                    </Button>
                </DataTemplate>
            </telerik:GridViewColumn.CellTemplate>
        </telerik:GridViewColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>

Second question, i want bind a business property in a column footer,
<telerik:GridViewDataColumn IsFilterable="False" IsReadOnly="True" Header="Desconto 2" DataMemberBinding="{Binding desconto2}" DataFormatString="{}{0:N2}%" Width="90" HeaderCellStyle="{StaticResource estiloDaColuna}" FooterCellStyle="{StaticResource GridViewCellStyleLeft}">
                                    <telerik:GridViewDataColumn.Footer>
                                        <StackPanel>
                                            <Label Content="Ola"></Label>
                                            <Label Content="{Binding Path=Descontos}"></Label>
                                        </StackPanel>
                                    </telerik:GridViewDataColumn.Footer>

Making that only appears the word "ola", the value in "Descontos" is not show. How can resolve it?

Thanks

2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 07 May 2012, 01:54 PM
Hello,

 When the GridView is in ReadOnly mode, then it will show only the CellTemplates of the column. The CellEditTemplates will not be shown. As you have defined the Button in the CellTemplate, then you can Enable/Disable the Button itself.

As to your second question, it depends where the 'Descontos' is defined. Is it defined in the DataContext of the GridView?

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Tiago
Top achievements
Rank 1
answered on 07 May 2012, 02:29 PM
Hi,

Ok, now i understand.

Well now i think both question have merged in one, because the property's  "pending" and "Descontos" are defined in the window datacontext, how can bind that?

Because in button if i bind the "pending" property it continues enabled anyway the value.
Tags
GridView
Asked by
Tiago
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Tiago
Top achievements
Rank 1
Share this question
or