Hi. First let me tell you what I'm trying to achieve. Basically, I'm trying to set up some conventions at our company to put some consistency on the table. The RadControls are excellent, but I want to have our own controls that inherit directly from the RadControls. For example, MyComboBox inherits from RadComboBox and MyComboBoxItem inherits from RadComboBoxItem, like so...
MyComboBox.xaml:
<telerik:MyComboBox x:Name="Sandbox.MyComboBox" FontFamily="./Fonts.zip#Calibri" FontSize="13" Height="22"...
MyComboBox.xaml.cs
public partial class MyComboBox : RadComboBox { ... }
The same technique is used for the RadComboBoxItem. I've also applied custom templates (not styles) to define how they should be look. This way, even without cascading styles (waiting for SL3), I can define a default appearance that can be overridden by styles. Furthermore, I can't make the mistake of setting the height of a RadComboBox to 24 later on down the line because it will be overridden by MyComboBox's properties, which is exactly what I want to happen in this case. If Silverlight 2 handled cascading styles I probably wouldn't need any of this, but we have to wait for SL3 for that, don't we?
Now, here's where my question comes in. I've bound data to the MyComboBox and although I have my own MyComboBoxItem controls, the RadComboBox control automatically binds data with the RadComboBoxItem. I've specifically designed MyComboBoxItem to show a highlighted color on MouseOver, but it doesn't show because I can't figure out how to get MyComboBoxItem to bind to the RadComboBox instead of the RadComboBoxItem.
Do I have to start from scratch and create my own Telerik theme instead? Is there a way I can bind data to MyComboBoxItem without losing functionality? I lost functionality when I tried this:
With the above example, the ComboBoxItems would no longer respond to mouse clicks. Weird!
MyComboBox.xaml:
<telerik:MyComboBox x:Name="Sandbox.MyComboBox" FontFamily="./Fonts.zip#Calibri" FontSize="13" Height="22"...
MyComboBox.xaml.cs
public partial class MyComboBox : RadComboBox { ... }
The same technique is used for the RadComboBoxItem. I've also applied custom templates (not styles) to define how they should be look. This way, even without cascading styles (waiting for SL3), I can define a default appearance that can be overridden by styles. Furthermore, I can't make the mistake of setting the height of a RadComboBox to 24 later on down the line because it will be overridden by MyComboBox's properties, which is exactly what I want to happen in this case. If Silverlight 2 handled cascading styles I probably wouldn't need any of this, but we have to wait for SL3 for that, don't we?
Now, here's where my question comes in. I've bound data to the MyComboBox and although I have my own MyComboBoxItem controls, the RadComboBox control automatically binds data with the RadComboBoxItem. I've specifically designed MyComboBoxItem to show a highlighted color on MouseOver, but it doesn't show because I can't figure out how to get MyComboBoxItem to bind to the RadComboBox instead of the RadComboBoxItem.
Do I have to start from scratch and create my own Telerik theme instead? Is there a way I can bind data to MyComboBoxItem without losing functionality? I lost functionality when I tried this:
<Sandbox:MyComboBox x:Name="MyCombo" ItemsSource="{StaticResource customers}"> |
<Sandbox:MyComboBox.ItemTemplate> |
<DataTemplate> |
<Sandbox:MyComboBoxItem Content="{Binding Content}"/> |
</DataTemplate> |
</Sandbox:MyComboBox.ItemTemplate> |
</Sandbox:MyComboBox> |
With the above example, the ComboBoxItems would no longer respond to mouse clicks. Weird!