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

Find DataFormField

5 Answers 25 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 15 May 2013, 02:10 PM
Hi,

how to find a DataFormField  <telerik:DataFormComboxField> on EditEnded?
I have to Change the value by code and have to find this field!

Thanks
Best Regards
Rene

5 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 17 May 2013, 01:53 PM
Hello,

 You can use ChildrenOfType<DataFormDataField>(). It is an extension method to DependencyObject and it is located in the Telerik.Windows.Controls namespace, Telerik.Windows.Controls assembly.

Greetings,
Ivan Ivanov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ITA
Top achievements
Rank 1
answered on 22 May 2013, 02:44 PM
Hi,

I tried this, but without any success:
SelectedValuePath="ID" DisplayMemberPath="Name" DataMemberBinding="{Binding Staat, Mode=TwoWay}" Grid.Row="5" Padding="0" Margin="0,5,0,5" Width="350" Name="Staat1_cbx"
                                                                  ItemsSource="{Binding Country, Source={StaticResource Test}}" Label="{Binding Source={StaticResource Lang}, XPath=KundenStaat/@Header}" telerik:StyleManager.Theme="Windows8"  />

var TEST= this.KundenKontaktForm.ChildrenOfType<DataFormComboBoxField>().FirstOrDefault(t => t.Name == "Staat1_cbx");

Test is null! why?
Thanks
best Regards
Rene

0
Ivan Ivanov
Telerik team
answered on 22 May 2013, 03:04 PM
Hi,

Is this ComboBoxFileld defined in the EditTemplate? If so, it is not yet loaded at this point. Try invoking the retrieving logic through a dispatcher.

Regards,
Ivan Ivanov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
ITA
Top achievements
Rank 1
answered on 22 May 2013, 03:08 PM
Hi,

it is loaded, because i try to get this Field on EditEnded of my DataForm. I Change the item in the
combobox and press OK in my DataForm. Than i try to get this Field, but it is null, what ever
i do.

Ok i think i have the Problem. If i use the same Template for "ReadOnlyTemplate" and "EditTemplate", it
works fine. But if i use a different Template for Editmode the Field is null.

Thanks
rene

 

0
Ivan Ivanov
Telerik team
answered on 22 May 2013, 03:34 PM
Hello,

 Can you please send us a sample project that illustrates your scenario? We will debug it and send you a modified version back.

Regards,
Ivan Ivanov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
DataForm
Asked by
ITA
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
ITA
Top achievements
Rank 1
Share this question
or