this.grid.Columns.Clear();
this.grid.ColumnGroups.Clear();
var gridColumn = new GridViewDataColumn();
var gridColumn2 = new GridViewDataColumn();
if (this.IncludeGroup.IsChecked != null && (bool)this.IncludeGroup.IsChecked)
{
this.grid.ColumnGroups.Add(new GridViewColumnGroup
{
Name = "A",
Header = "A"
});
this.grid.ColumnGroups.Add(new GridViewColumnGroup
{
Name = "B",
Header = "B"
});
gridColumn.ColumnGroupName = "A";
gridColumn2.ColumnGroupName = "B";
}
gridColumn.UniqueName = "a";
gridColumn.Header = "Name";
var textBinding = new Binding("Name");
textBinding.Mode = BindingMode.OneWay;
gridColumn.DataMemberBinding = textBinding;
this.grid.Columns.Add(gridColumn);
gridColumn2.UniqueName = "b";
gridColumn2.Header = "Name";
var textBinding2 = new Binding("Year");
textBinding2.Mode = BindingMode.OneWay;
gridColumn2.DataMemberBinding = textBinding2;
this.grid.Columns.Add(gridColumn2);Upgrading to the latest Telerik release results in a NullReferenceException in Caliburn Micro ActionMessage.SetMethodBinding on application load. The issue is specific to the ExecuteOnLoad event handler Sequence which tries to resolve bindings for the control that is loading.
In our case, the control is a RadButton. The Exception is thrown when the Source property of the ActionExecutionContext in Caliburn Micro is dereferenced. The Source property is set to the value of the ActionMessage’s AssociatedObject property when the object is constructed a few frames higher on the call stack.
For some reason, the AssociatedObject property is set correctly with the Button controls in the prior telerik release, but not with this latest one.
Additionally, this problem is specific to Caliburn Micro Actions set up in Styles vs. on the control itself. IOW this code causes the exception:
<Style x:Key="FooStyle" TargetType="telerik:RadButton">
<Setter Property="ToolTip" Value="Foo Tip"/>
<Setter Property="cal:Message.Attach" Value="[Click]=[Foo]"/>
</Style>
<telerik:RadButton x:Name="_fooButton" Style="{StaticResource FooStyle}"/>
While this code does not
<Style x:Key="FooStyle" TargetType="telerik:RadButton">
<Setter Property="ToolTip" Value="Foo Tip"/>
</Style>
<telerik:RadButton x:Name="_fooButton"
Style="{StaticResource FooStyle}"
cal:Message.Attach = "[Click]=[Foo]"/>
Again, setting the Message.Attach property in a style worked fine in the last Telerik release. It causes an exception in this latest release.
We have many buttons in our application that are styled like this and it will be a large effort to convert them as a workaround in order to use the latest Telerik controls. Before we do so, we’d like to know what changed and whether there is a less invasive workaround.
<Border Grid.Row="1" telerikControls:StyleManager.Theme="Expression_Dark"> <Grid> <!--<Grid.Effect> <DropShadowEffect BlurRadius="10" Color="Black"/> </Grid.Effect>--> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition> </Grid.ColumnDefinitions> <telerik:RadTabControl x:Name="tabDisplays" Grid.Column="0" TabOrientation="Horizontal" TabStripPlacement="Left" Align="Right" telerikControls:StyleManager.Theme="Expression_Dark" ItemsSource="{Binding Path=DisplayTabs}" SelectionChanged="RadTabControl_SelectionChanged_1"> <telerik:RadTabControl.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Name}" /> </DataTemplate> Code behindthis.DataContext = new MainWindowViewModel();
StyleManager.ApplicationTheme = new Office_BlackTheme();
<img width="387" height="164" id="Picture_x0020_3" src="cid:image001.png@01CE15AF.A375F5C0">private void RadGridView_PreparingCellForEdit(object sender, GridViewPreparingCellForEditEventArgs e) { switch (e.column.Name) { case "MyDynamicColumn": var combobox = e.EditingElement as RadComboBox; combobox.ItemsSource = List<string> { "1", "2", "3" }; //TODO: Replace with some dynamic business logic here combobox.SetBinding(RadComboBox.SelectedValueProperty, "MyComboValue"); break; } } }