我想darg&像按钮一样(实际上是它后面的任何UI元素)从Infrastics菜单下拉到Grid
。
但这似乎是不可能做到的。
通常我确实喜欢
<Border Margin="2,0" CornerRadius="5" Name="MyControl1" BorderBrush="LightGray" BorderThickness="1" MouseLeftButtonDown="captureMyControl1_MouseLeftButtonDown" MouseLeftButtonUp="captureMyControl1_MouseLeftButtonUp" MouseMove="captureMyControl1_MouseMove">
我可以拖动&放弃它,因为它有合适的方法。但我们似乎无法使用Infrastics功能区菜单
这个代码是
<ig:XamRibbonTabItem>
<ig:XamRibbonGroup>
<ig:VerticalRibbonToolContainer>
<Border Margin="2,0" CornerRadius="5" Name="MyControl1"
<tools:ButtonToolEx
我的意思是,我看不出功能区按钮有这些方法,或者我们可以在它上面添加Border
。
我的问题可能会被重新定义为:我们可以在Infrastics菜单中使用标准的SIlverlight控件吗?有线索吗?
我不会放代码,因为有很多东西,但我会参考这个伟大的链接
http://www.infragistics.com/community/forums/t/39619.aspx
现在想象一下,你可以像那样做,而不是private ComboBox _combo;
private MyCUstomUSerControl _myCUstomUSerControl;
这是在Infrastics Ribbon菜单中实现任何自定义用户控件的一种方法。
祝大家今天愉快!
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>
附言:也看看这个链接http://www.infragistics.com/samples/wpf/ribbon/custom-tools