Question

I am using Caliburn.Micro.Telerik conventions project.

I have view that dynamically loads telerik Tabs view models:

<telerik:RadTabControl x:Name="Items" Grid.Row="1" Margin="10,0,0,0" />

I have set IsEnabled property onone of the Tabs view models to false, but that Tab is always enabled.

Is this supported? If not, how can I add it?

Was it helpful?

Solution

I'm pretty sure that CM doesn't allow more than a single property for element conventions and I'm not sure what the default property for RadTabItem is. You can always use an explicit binding using a style on the tab control

<telerik:RadTabControl x:Name="Items" Grid.Row="1" Margin="10,0,0,0">
    <telerik:RadTabControl.Resources>
        <Style TargetType="telerik:RadTabItem">
            <Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
        </Style>
    </telerik:RadTabControl.Resources>
</telerik:RadTabControl>

Or try using ConventionManager and setting the default convention for them (though this is probably already set to something in the Telerik CM framework)

ConventionManager.AddElementConvention<RadTabItem>(RadTabItem.IsEnabledProperty, "IsEnabled", "?");

(You might have noticed the "?", I'm not sure what events RadTabItem has available and which should be the default event to trigger actions so you'd have to fill this one in yourself, see here for more info: Caliburn element convention)

Edit:

Actually looking at the src, it seems no default convention is supplied for RadTabItem

https://github.com/vcaraulean/Caliburn.Micro.Telerik/blob/master/WPF/Caliburn.Micro.Telerik/TelerikConventions.cs

So it looks like you should go down the ConventionManager route

OTHER TIPS

I have tried using ConventionManager but was not successful.

I ended up using this XAML as suggested by Charleh and Valeriu at github Issue page (https://github.com/vcaraulean/Caliburn.Micro.Telerik/issues/12#issuecomment-11840602):

<telerik:RadTabControl x:Name="Items">
    <telerik:RadTabControl.ItemContainerStyle>
        <Style TargetType="telerik:RadTabItem">
            <Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
        </Style>
     </telerik:RadTabControl.ItemContainerStyle>
</telerik:RadTabControl>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top