I've got a class described in XAML as xiasma.icons.myusercontrol which looks a little like this:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
x:Class=" xiasma.icons"
x:Name="myusercontrol"
Width="48" Height="48">
<Grid x:Name="LayoutRoot">
<Ellipse Margin="12,12,12,12" Stroke="#000000" StrokeThickness="2" x:Name="Circle">
<Ellipse.Fill>
<LinearGradientBrush StartPoint="1,0.8" EndPoint="0,0.5" SpreadMethod="Pad">
<GradientStop Color="#FF7C3D4C" Offset="0"/>
<GradientStop Color="#FFFD93AD" Offset="1"/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FF000000" StrokeThickness="7" Margin="18.5,12.5,18.5,12.5" Data="M0,8 L0,16" />
<Path Fill="#FFFFFFFF" Stretch="Fill" Stroke="#FF000000" StrokeThickness="7" Margin="12.5,18.5,12.5,18.5" Data="M8,8 L16,8" />
</Grid>
</UserControl>
I want to populate a sandribbon group dynamically at runtime with each instance of the button being a different colour
eg the "Circle" brush would be programmatically altered.
Now, I don't care what type xiasma.icons.myusercontrol is - it's a usercontrol so I could use the editor. But because the brush isn't known until runtime, I can't pre-render a bitmap to assign to the sandribbon.button.image property.
At the moment, I just add the usercontrols to the ribbongroup, but this isn't very good as the mouseover effects don't match those of "real" sandribbon buttons.
Am I doing something fundamentally wrong?
Thanks in advance,
Adrian