<telerik:RadTabItem.Content> |
<telerik:RadTreeView Name="TreeViewCategories" SelectionMode="Extended" |
IsLineEnabled="True" ItemsOptionListType="CheckList" IsOptionElementsEnabled="True" |
IsRootLinesEnabled="True" IsTriStateMode="True" > |
<telerik:RadTreeView.ItemTemplate> |
<HierarchicalDataTemplate ItemsSource="{Binding Path=ChildCategories, Mode=TwoWay}"> |
<StackPanel> |
<TextBlock Text="{Binding Name}" Name="textblockName"></TextBlock> |
</StackPanel> |
</HierarchicalDataTemplate> |
</telerik:RadTreeView.ItemTemplate> |
</telerik:RadTreeView> |
</telerik:RadTabItem.Content> |
void ItemContainerGenerator_StatusChanged(object sender, EventArgs e) |
{ |
if ((sender as RadTreeView).ItemContainerGenerator.Status == System.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated) |
{ |
foreach (RadTreeViewItem item in TreeViewCategories.Items) |
{ |
item.CheckState = System.Windows.Automation.ToggleState.On; |
} |
} |
} |
Hello everybody.
I have a RadGridView whith three column teo of whic are displayed and edited using cell templates with a radComboBox and a TextBox
The following is the XAML code
<telerik:RadGridView x:Name="radGridDiscounts" HorizontalAlignment="Left" Height="150" Width ="500" AutoGenerateColumns="False" ShowGroupPanel="False" MultipleSelect="False" ColumnsWidthMode="Fill" ItemsSource="">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="Descrizione" HeaderTextAlignment="Center" Width="200"
DataMemberBinding="{Binding Description}" IsReadOnly="True" IsFilterable="False" />
<telerik:GridViewDataColumn Header="Tipologia sconto" HeaderTextAlignment="Center" Width="120" IsFilterable="False">
<telerik:GridViewColumn.CellTemplate>
<DataTemplate>
<telerik:RadComboBox x:Name="radComboOperations"
SelectionChanged="radComboOperations_SelectionChanged Loaded="radComboOperations_Loaded"
DisplayMemberPath="Description" SelectedValuePath="Id"/>
</DataTemplate>
</telerik:GridViewColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="Valore" HeaderTextAlignment="Center" Width="75" IsFilterable="False" IsSortable="False"
<telerik:GridViewColumn.CellTemplate>
<DataTemplate>
<TextBox x:Name="textBoxValue" TextChanged="textBoxValue_TextChanged" Loaded="textBoxValue_Loaded"/>
</DataTemplate>
</telerik:GridViewColumn.CellTemplate>
</telerik:GridViewDataColumn>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
So for every record displayed in the radGridView, "radComboOperations" is a radcombobox displayed in one cell template and "textBoxValue" is a textBox of the other cell template.
During the "_Loaded" operations of both controls I initialize properly the values must be displayed.
And there is no problem at all until now.
What do I have to do is to change Text or IsEnabled properties of "textBoxValue" of the corresponding Item ot the radGirdView, when a radComboOperations_SelectionChanged event of "radComboOperations" is raised.
The following is my function for the event
private void radComboOperations_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
RadComboBox comboBox = (RadComboBox)sender;
if (comboBox!=null)
{
MyDTO dto = (MyDTO)comboBox.DataContext;
MyOperation Operation = (MyOperation)comboBox.SelectedItem;
if (Operation.Id == Guid.Empty)
{
//need help here where
//I have to disable the textBoxValue of the corresponding item of the radGridView
//where and how can I find the textBoxValue text box of the cell template??
}
}
}
I will thank a lot everyone may help me!!
Bye everybody
Nick
<UserControl x:Class="UserControl1" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
Height="300" Width="300"> |
<Grid> |
<Grid.RowDefinitions> |
<RowDefinition Height="Auto"/> |
</Grid.RowDefinitions> |
<telerik:RadNumericUpDown Maximum="100" Minimum="0" IsInteger="True"/> |
</Grid> |
</UserControl> |
I have a column with a checkbox in it which will reflect the selection status of the row. This column is added via the xmal and the other columns are binding to the data source.
Same implementation as the following link:
http://www.telerik.com/community/forums/wpf/gridview/button-and-checkbox-on-row.aspx
They work very well and only one issue for me. I can sort other columns by default, but nothing happen when I click the header of the checkbox column, neither the colour will change when I move the mouse over it like other columns.
Is it possible to sort the grid be selection status of the rows (true or false) when I click the header of this column, just like a REAL data column?
Many thanks!
John