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

GridView DataTemplate in dynamic xaml

2 Answers 226 Views
GridView
This is a migrated thread and some comments may be shown as answers.
lina fetisova
Top achievements
Rank 1
lina fetisova asked on 16 Jun 2010, 11:28 AM
Good day!
I have such a form:

<Grid x:Name="LayoutRoot">
<StackPanel x:
Name="spQuestions" Orientation="Vertical" Grid.Column="1" Grid.Row="8" Grid.ColumnSpan="3" HorizontalAlignment="Left">
</StackPanel>
<
/Grid>


and I put there a RadGridView using xaml.cs file:

RadGridView gridView = new RadGridView();
gridView.ItemsSource = 
question.Answers;
gridView.AutoGenerateColumns = false;
gridView.ScrollMode
 = Telerik.Windows.Controls.GridView.ScrollUpdateMode.RealTime;gridView.ShowGroupPanel = false;
spQuestions.Children.Add(gridView);

So I make my xaml dynamically.

Is it possible to make someting like such structure usin dinamic xaml
<telerikGridView:GridViewDataColumn Header="Варианты ответа" UniqueName="Name" MinWidth="300" MaxWidth="2000">
   <telerikGridView:GridViewDataColumn.CellTemplate>
       <DataTemplate>
          <RadioButton Content="{Binding Text}" FontFamily="Verdana" FontSize="13" Foreground="#FF170000" />
       </DataTemplate>
   </telerikGridView:GridViewDataColumn.CellTemplate>
</telerikGridView:GridViewDataColumn>


?

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 16 Jun 2010, 11:42 AM
Hi,

 Yes you can however it will be better if you create a custom column, inherit from desired column type, override CreateCellElement and return desired control(s). You can check this blog post for more info. 

If you still want to know how to parse XAML dynamically you can check this blog post.

Best wishes,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
lina fetisova
Top achievements
Rank 1
answered on 17 Jun 2010, 07:00 AM
Vlad thank you very much!! =) That's great!

but now I have enother problem - http://www.telerik.com/community/forums/wpf/gridview/datatemplate-with-radiobutton-in-dynamic-xaml.aspx
Tags
GridView
Asked by
lina fetisova
Top achievements
Rank 1
Answers by
Vlad
Telerik team
lina fetisova
Top achievements
Rank 1
Share this question
or