I would like to darg&drop from Infragistics menu like a button (in fact any UI element behind it) to the Grid
.
But It seems is impossible to do.
Normally I do like
<Border Margin="2,0" CornerRadius="5" Name="MyControl1" BorderBrush="LightGray" BorderThickness="1" MouseLeftButtonDown="captureMyControl1_MouseLeftButtonDown" MouseLeftButtonUp="captureMyControl1_MouseLeftButtonUp" MouseMove="captureMyControl1_MouseMove">
And I can drag&drop it because it has appropriate methods. But it seems like we cannot do this with Infragistics Ribbon Menu
and this code
<ig:XamRibbonTabItem>
<ig:XamRibbonGroup>
<ig:VerticalRibbonToolContainer>
<Border Margin="2,0" CornerRadius="5" Name="MyControl1"
<tools:ButtonToolEx
I mean I cannot see that for instance Ribbon Button has those methods or we can add Border
over it.
May be my question might be redefined like this: Can we use standard SIlverlight Controls in Infragistics Menu? Any clue?
FInally, I found a way to resolve that problem.
I am not gonna put the code because there lots of things but I will reference to this great link
http://www.infragistics.com/community/forums/t/39619.aspx
Now imagine that instead of private ComboBox _combo;
you can do like
private MyCUstomUSerControl _myCUstomUSerControl;
And this is a way to implement ANY custom user control within Infragistics Ribbon menu.
Have a nice day, folk!
public class ComboBoxTool : RibbonTool
{
protected override RibbonToolBaseControl ResolveToolControl()
{
return new ComboBoxToolControl(this);
}
public IEnumerable ItemsSource { get; set; }
}
public class ComboBoxToolControl : RibbonToolBaseControl, IRibbonControl
{
private ComboBox _combo;
public ComboBoxToolControl()
{
this.DefaultStyleKey = typeof(ComboBoxToolControl);
}
public ComboBoxToolControl(RibbonToolBase tool) : base(tool)
{
this.DefaultStyleKey = typeof (ComboBoxToolControl);
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
this._combo = GetTemplateChild("Combo") as ComboBox;
if (this._combo != null)
this._combo.ItemsSource = ((ComboBoxTool) this.Tool).ItemsSource;
}
}
Then you need to define the style for the ComboBoxToolControl in your generic.xaml file:
<Style TargetType="cust:ComboBoxToolControl">
<Setter Property="Foreground" Value="Green"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="cust:ComboBoxToolControl">
<Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" Background="Transparent">
<Grid >
<ComboBox x:Name="Combo" Width="100" Height="24" />
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
At this point you should be able to add your combo box tool to the ribbon:
<igr:XamWebRibbonTabItem>
<igr:XamWebRibbonGroup>
<cust:ComboBoxTool ItemsSource="{StaticResource inventory}">
</cust:ComboBoxTool>
</igr:XamWebRibbonGroup>
</igr:XamWebRibbonTabItem>
P.S. And have a look at this link as well http://www.infragistics.com/samples/wpf/ribbon/custom-tools