This question is locked. New answers and comments are not allowed.
Hi All,
I am using Telerik Radtreelistview grid.
I have a Checkbox in the screen "Display Code"
I am assigning the Itemsource to the grid as below mlist.ItemsSource = e.Result.objPrbListView.MasterList; Now the grid is populated.
In my Grid I have a column to display code or text with Header like "Code / Text" Based on the checkbox select and unselect I have to display Code or Text in grid column. I will be having both Code and Text in serparately in the observable collection. How can I bind values to that column based on the checkbox click. Thanks for any suggestion to code this.
Regards, V.Chocks.
I am assigning the Itemsource to the grid as below mlist.ItemsSource = e.Result.objPrbListView.MasterList; Now the grid is populated.
In my Grid I have a column to display code or text with Header like "Code / Text" Based on the checkbox select and unselect I have to display Code or Text in grid column. I will be having both Code and Text in serparately in the observable collection. How can I bind values to that column based on the checkbox click. Thanks for any suggestion to code this.
Regards, V.Chocks.
5 Answers, 1 is accepted
0
Hello,
Vlad
the Telerik team
Have you tried to define custom CellTemplate for this column or IValueConverter for the DataMemberBinding where you can place your logic?
All the best,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Chocks
Top achievements
Rank 1
answered on 10 Aug 2012, 05:39 AM
Hi,
I browsed some samples in forum, but I am not sure that matches this requirement.
The below Name TextBlock is existing
<TextBlock Grid.Column="3" Text="{Binding Name}" VerticalAlignment="Center" x:Name="txtName" TextWrapping="Wrap"/>
now added the below Code TextBlock in XAML. Both TextBlock are in same GridColum.
<TextBlock Grid.Column="3" Text="{Binding Code}" VerticalAlignment="Center" x:Name="txtCode" TextWrapping="Wrap"/>
Is it possible to make any one visible based on the CheckBox Click.
Thanks for any code and suggesstions.
Regards,
V.Chocks.
I browsed some samples in forum, but I am not sure that matches this requirement.
The below Name TextBlock is existing
<TextBlock Grid.Column="3" Text="{Binding Name}" VerticalAlignment="Center" x:Name="txtName" TextWrapping="Wrap"/>
now added the below Code TextBlock in XAML. Both TextBlock are in same GridColum.
<TextBlock Grid.Column="3" Text="{Binding Code}" VerticalAlignment="Center" x:Name="txtCode" TextWrapping="Wrap"/>
Is it possible to make any one visible based on the CheckBox Click.
Thanks for any code and suggesstions.
Regards,
V.Chocks.
0
Hello,
Vlad
the Telerik team
Indeed you can bind the IsCheckec property of the CheckBox to a property in your view-model and you can bind any component Visibility to your view-model property using BooleanToVisibilityConverter.
All the best,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Chocks
Top achievements
Rank 1
answered on 10 Aug 2012, 07:16 AM
Hi Vlad
Actually the checkbox is not inside the grid, it is place separately above the grid.
Is it possible, that i could do this by using Linq or any other binding method which would not affect the performance and change the value in the column. Give any sample code if available. I think I can't implement View Model type, because I dont have
separate folders for View and Model.
I tried something like below, but it seams, it will affect performance, It will be helpful, If i am resolving this by any binding or any other Linq update queries.
ObservableCollection<PList> lstPrb = mlist.ItemsSource as ObservableCollection<PList>;
foreach (PList list in lstPrb)
{
if (chkDisplayFreeorCodedText.IsChecked.Value)
{
list.PrbName = list.FreeText;
}
else
{
list.PrbName = list.Code ;
}
}
Thanks,
V.Chocks.
Actually the checkbox is not inside the grid, it is place separately above the grid.
Is it possible, that i could do this by using Linq or any other binding method which would not affect the performance and change the value in the column. Give any sample code if available. I think I can't implement View Model type, because I dont have
separate folders for View and Model.
I tried something like below, but it seams, it will affect performance, It will be helpful, If i am resolving this by any binding or any other Linq update queries.
ObservableCollection<PList> lstPrb = mlist.ItemsSource as ObservableCollection<PList>;
foreach (PList list in lstPrb)
{
if (chkDisplayFreeorCodedText.IsChecked.Value)
{
list.PrbName = list.FreeText;
}
else
{
list.PrbName = list.Code ;
}
}
Thanks,
V.Chocks.
0
Chocks
Top achievements
Rank 1
answered on 13 Aug 2012, 04:24 AM
Hi,
The below is working fine when the checkbox is selected, is there any way to check for the Unchecked property to bind.
I trid by giving !IsChecked as in 2nd TextBlock., it doesnt work. Thanks for any codes.
<TextBlock Grid.Column="3" Text="{Binding FText}" Visibility="{Binding IsChecked, ElementName=chkDisplayFText}" ></TextBlock>
<TextBlock Grid.Column="3" Text="{Binding CText}" Visibility="{Binding !IsChecked, ElementName=chkDisplayFText}" ></TextBlock>
Thanks,
V.Chocks.