or
private
DataTemplate GetDataTemplate(Esri.ArcGISRuntime.Data.FieldInfo fieldInfo, CodedValueDomain codedValueDomain)
{
StringBuilder stringBuilder =
new
StringBuilder();
stringBuilder.Append(
"<DataTemplate "
);
stringBuilder.Append(
"xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' "
);
stringBuilder.Append(
"xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' "
);
stringBuilder.Append(
"xmlns:telerik='http://schemas.telerik.com/2008/xaml/presentation'>"
);
if
(codedValueDomain !=
null
)
stringBuilder.Append(
string
.Format(@
"<telerik:RadComboBox Name="
"comboBox"
" SelectedValue="
"{{Binding Attributes[{0}], Mode=TwoWay}}"
" DisplayMemberPath="
"Value"
" SelectedValuePath="
"Key"
" HorizontalAlignment="
"Stretch"
" />"
, fieldInfo.Name));
else
if
(fieldInfo.Type == FieldType.Integer || fieldInfo.Type == FieldType.Double || fieldInfo.Type == FieldType.SmallInteger || fieldInfo.Type == FieldType.Single)
stringBuilder.Append(
string
.Format(@
"<telerik:RadNumericUpDown Value="
"{{Binding Attributes[{0}], Mode=TwoWay}}"
" HorizontalAlignment="
"Stretch"
"/>"
, fieldInfo.Name));
else
if
(fieldInfo.Type == FieldType.Date)
stringBuilder.Append(
string
.Format(@
"<telerik:RadDateTimePicker SelectedValue="
"{{Binding Attributes[{0}], Mode=TwoWay}}"
" HorizontalAlignment="
"Stretch"
" InputMode="
"DatePicker"
"/>"
, fieldInfo.Name));
else
stringBuilder.Append(
string
.Format(@
"<telerik:RadMaskedTextInput Value="
"{{Binding Attributes[{0}], Mode=TwoWay}}"
" TextMode="
"PlainText"
" Mask="
""
" HorizontalAlignment="
"Stretch"
"/>"
, fieldInfo.Name));
stringBuilder.Append(
"</DataTemplate>"
);
DataTemplate dataTemplate = System.Windows.Markup.XamlReader.Parse(stringBuilder.ToString())
as
DataTemplate;
return
dataTemplate;
}
query.Where
(cust => cust.Name.Contains(filter) ||
cust.Contacts.Any(contact => contact.LastName.Contains(filter)));
the Code below is Bound to IsExpanded of RadTreeItem
public
bool
IsExpanded
{
get
{
return
isExpanded;
}
set
{
try
{
if
(isExpanded != value)
{
if
(value)
{
if
(Children.Contains(dummy))
{
Children.Remove(dummy);
}
LoadChildren();
}
}
isExpanded = value;
RaisePropertyChanged(() => IsExpanded);
}
catch
(Exception e)
{
if
(!HasItems)
{
//if empty, add dummy to keep the expander.
Children.Add(dummy);
}
//any exception will keep this node collapsed.
isExpanded =
false
;
RaisePropertyChanged(() => IsExpanded);
throw
;
}
}
}
Inside the catch statement, I want to force collapse the treeitem if there is an error. If I put "throw" the tree item DOES NOT collapse. when I remove the "throw" it collapses successfully. Why "throw" is preventing the treeitem to collapse?
We need the "throw" because IsExpanded is called by another method that catches the exception and do some logic.