I have this grid:
<igGrid:XamGrid x:Name="GridLotes" > <igGrid:XamGrid.Columns> <igGrid:TemplateColumn Key="Especificacao" Width="400" MinimumWidth="300" IsSortable="True"> <igGrid:TemplateColumn.HeaderTemplate> <DataTemplate> <TextBlock Text="ESPECIFICAÇÃO" HorizontalAlignment="Left" /> </DataTemplate> </igGrid:TemplateColumn.HeaderTemplate> <igGrid:TemplateColumn.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Especificacao}" x:Name="GridLotesEspecificacao" HorizontalAlignment="Left" TextWrapping="Wrap" /> </DataTemplate> </igGrid:TemplateColumn.ItemTemplate> </igGrid:TemplateColumn> <igGrid:TemplateColumn Key="Preco" CellStyle="{StaticResource GridCellEdit}" Width="130" MinimumWidth="130"> <igGrid:TemplateColumn.HeaderTemplate> <DataTemplate> <TextBlock Text="PREÇO" HorizontalAlignment="Left" /> </DataTemplate> </igGrid:TemplateColumn.HeaderTemplate> <igGrid:TemplateColumn.ItemTemplate> <DataTemplate> <igEditors:XamNumericEditor Mask="{}{double:9.4}" x:Name="GridLotesPreco" Background="Transparent" BorderThickness="0" LostFocus="GridPropostasCellPreco_LostFocus" GotFocus="GridPropostasCellPreco_GotFocus" Value="{Binding Preco, Mode=TwoWay}" Margin="0,0,0,0" /> </DataTemplate> </igGrid:TemplateColumn.ItemTemplate> </igGrid:TemplateColumn> </igGrid:XamGrid.Columns></igGrid:XamGrid>
And I want to find these 2 controls "GridLotesPreco" and "GridLotesEspecificacao" to change his proprties in dynamically.
How can I find these controls ?
Hi,
What kind of properties are you trying to change?
The recommended way of doing these types of things is generally through bindings.
The xamGrid virtualizes/recycles all cell controls, so you can't really change just one cells dynamically in code behind. Otherwise, when you do, it'll show up changed on another row when you scroll.
If you're just trying to modify styles based on value changing, you can take a look at our Conditional Formatting feature.
http://help.infragistics.com/NetAdvantage/Silverlight/2010.3/CLR4.0/?page=xamGrid_Conditional_Formatting.html
-SteveZ
Can I find these controls ? Yes or No ?
The only way would be though using CellControlAttached and looking at e.Cell.Control.Content
However, thats going to have side effects like i mentioned before, b/c of recycling.
If you could provide more information on what you're trying to modify, we can probably help you find a better way to do what you need.
Here's a link to msdn FindName method. It will explain the command in more depth than I could here.
http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.findname.aspx
Let me know if you have further questions.
So, it´s possible.
Can you send me a code sample?
Where you able to the use the link Steve supplied and use the conditional formatting?
It is possible to use FindName to find a control but if you are trying to change the settings bases on some value or for a specific row, you’ll want to use the conditional formatting.
If you have any further questions, please let me know.