Hi,
I am using a xamcomboeditor inside a xamribbon.Followed the following sample
http://forums.infragistics.com/forums/p/50014/263304.aspx
how do we get selecteditems of xamcomboeditortool?
thanks.
Hello,
I have been looking into your question and I can suggest you define properties for the fields in the ‘XamComboEditorToolControl’ and ‘XamComboEditorTool’ classes. Using them you can access the XamComboEditor in the XamComboEditorTool. I am sending you a modified version of the sample application(RibbonSample Modified.zip) from the provided forum thread link.
If you need any further assistance, feel free to ask.
hi,
thank you for your reply.
i have created the properties for selecteditem and event handler for selectionchanged as shown. But the issue is comboeditortool.selecteditem is always null. Can you please let me know the issue in the following code?
public class XamComboEditorTool : RibbonTool { private XamComboEditorToolControl _control; public XamComboEditorToolControl Control { get { return _control; } set { _control = value; } } private void UpdateBindings() { if (this._control != null) { this._control.OnApplyTemplate(); } } protected override RibbonToolBaseControl ResolveToolControl() { XamComboEditorToolControl control = new XamComboEditorToolControl(this); if (this._control == null) { this._control = control; } return control; } public IEnumerable ItemsSource { get { return (IEnumerable)GetValue(ItemsSourceProperty); } set { SetValue(ItemsSourceProperty, value); this.UpdateBindings(); } } public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(XamComboEditorTool), null); public String DisplayMemberPath { get; set; } public object SelectedItem { get { return (object)GetValue(SelectedItemProperty); } set { SetValue(SelectedItemProperty, value); this.UpdateBindings(); } } public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register("SelectedItem", typeof(object), typeof(XamComboEditorTool), new PropertyMetadata(null)); public event EventHandler SelectionChanged; public void SelectionChangedEventHandler(object sender, EventArgs e) { if (SelectionChanged != null) SelectionChanged(sender, e); } } public class XamComboEditorToolControl : RibbonToolBaseControl, IRibbonControl { private XamComboEditor _combo; public XamComboEditor Combo { get { return _combo; } set { _combo = value; } } public XamComboEditorToolControl() { this.DefaultStyleKey = typeof(XamComboEditorToolControl); } public XamComboEditorToolControl(RibbonToolBase tool) : base(tool) { this.DefaultStyleKey = typeof(XamComboEditorToolControl); } public override void OnApplyTemplate() { base.OnApplyTemplate(); this._combo = GetTemplateChild("XamComboEditor") as XamComboEditor; if (this._combo != null) { this._combo.ItemsSource = ((XamComboEditorTool)this.Tool).ItemsSource; this._combo.DisplayMemberPath = ((XamComboEditorTool)this.Tool).DisplayMemberPath; this._combo.SelectionChanged += new EventHandler(((XamComboEditorTool)this.Tool).SelectionChangedEventHandler); this._combo.SelectedItem = ((XamComboEditorTool)this.Tool).SelectedItem; } } }
I am just checking if you require any further assistance on the matter.
i have few more issues with xamcomboeditortool.
XamComboEditorTool doesnot rebind with the new itemsource(after switching tabs).
Also, VerticalRibbonToolContainer doesnot work as expected with XamComboEditorTool. Following code is supposed to have
buttons in horizontal alignment
combobox and buttons in vertical aligment.
<ig:VerticalRibbonToolContainer>
<local:XamComboEditorTool Id="Combo" Width="75" Height="10" AllowMultipleSelection="False" CheckBoxVisibility="Collapsed"></local:XamComboEditorTool>
<ig:HorizontalRibbonToolContainer>
<ig:ButtonTool x:Name="Btn1" Caption="Site"></ig:ButtonTool>
<ig:ButtonTool x:Name="Btn2" Caption="Sector"></ig:ButtonTool>
<ig:ButtonTool x:Name="Btn3" Caption="Carrier"></ig:ButtonTool>
<ig:ButtonTool x:Name="Btn4" Caption="Grid"></ig:ButtonTool>
</ig:HorizontalRibbonToolContainer>
</ig:VerticalRibbonToolContainer>
please let me know if i am missing something?
I have been looking into your post and I have tested the provided code in my sample application and I am not sure how you use the ‘Width’, ‘Height’ and ‘AllowMultipleSelection’ properties of the XamComboEditoTool. They are not part of the properties of the RibbonTool :
http://help.infragistics.com/Help/NetAdvantage/Silverlight/2012.1/CLR4.0/html/InfragisticsSL5.Controls.Menus.XamRibbon.v12.1~Infragistics.Controls.Menus.RibbonTool_members.html
If I skip them, everything works. Also I cannot see where you change the ItemSource of the XamComboEditoTool.
Would you please send my your sample application where you issue occurs in order to provide you with more accurate assistance ?
Looking forward to hearing from you
i have attached the xamcomboeditortool class and usercontrol(which uses the xamcomboeditortool in xamribbon).
VerticalRibbonToolContainer doesnot work as expected in the above files.(controls are arranged horizontally even after specifying VerticalRibbonToolContainer)
Also, on MouseLeftButtonUp event, i am rebinding the comboboxes in code behind. i have noticed that rebinding works if resource washer for xamribbon is not used.
Rebinding doenot work if resource washer for xamribbon is used.
please let me know issue in the above code.
I took a look at your code, and the tools are arranged horizontally because of their size - they are displayed in their maximized sizing mode.
If you want to stack them vertically you'll need to set their "MaximumSize" property to "ImageAndTextNormal".
About the rebinding issue - I couldn't find the described logic in the code you provided, so I was unable to see what's going on there.
Hope this helps,
I am just checking if you require any further assistance on the matter .
After some research the functionality that you are looking for has been determined to be a new product idea. I have sent your product idea directly to our product management team. Our product team chooses new product ideas for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested ideas, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your idea is chosen for development, you will be notified at that time. Your reference number for this product idea is PI12060072.
If you would like to follow up on your product idea at a later point, you may contact Developer Support management via email. Please include the reference number of your product idea in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com
Thank you for your request.
i think buttongroup allows only allows images by default for a button. but i just need text for the button.Tools don't have any images. please check the following code.
tools are expected to be arranged in the following manner.
TabITem3 - Buttons stacked horizontally below the combobox.
TabItem4 - Two ComboBoxes stacked horizontally below the first combobox.
<ig:XamRibbonTabItem Header="TabItem3" x:Name="TabItem3" MouseLeftButtonUp="TabItem3_MouseLeftButtonUp"> <ig:XamRibbonGroup Caption="TabItem3Group3"> <ig:VerticalRibbonToolContainer> <local:XamComboEditorTool MaximumSize="ImageAndTextNormal" Id="TabItem3Group3Combo" Width="75" Height="10" AllowMultipleSelection="False" CheckBoxVisibility="Collapsed"></local:XamComboEditorTool> <ig:HorizontalRibbonToolContainer> <ig:ButtonTool MaximumSize="ImageAndTextNormal" x:Name="Btn1" Caption="Site"></ig:ButtonTool> <ig:ButtonTool MaximumSize="ImageAndTextNormal" x:Name="Btn2" Caption="Sector"></ig:ButtonTool> <ig:ButtonTool MaximumSize="ImageAndTextNormal" x:Name="Btn3" Caption="Carrier"></ig:ButtonTool> <ig:ButtonTool MaximumSize="ImageAndTextNormal" x:Name="Btn4" Caption="Grid"></ig:ButtonTool> </ig:HorizontalRibbonToolContainer> </ig:VerticalRibbonToolContainer> </ig:XamRibbonGroup> </ig:XamRibbonTabItem> <ig:XamRibbonTabItem Header="TabItem4" x:Name="TabItem4" MouseLeftButtonUp="TabItem4_MouseLeftButtonUp"> <ig:XamRibbonGroup Caption="TabItem4Group1"> <ig:VerticalRibbonToolContainer> <local:XamComboEditorTool Id="TabItem4Group1Combo1" Width="75" Height="10" AllowMultipleSelection="False" CheckBoxVisibility="Collapsed" MaximumSize="ImageAndTextNormal" SelectionChanged="TabItem4Group1Combo1_SelectionChanged"></local:XamComboEditorTool> <ig:HorizontalRibbonToolContainer> <local:XamComboEditorTool MaximumSize="ImageAndTextNormal" Id="TabItem4Group1Combo2" Width="150" Height="10" AllowMultipleSelection="True" CheckBoxVisibility="Visible"></local:XamComboEditorTool> <local:XamComboEditorTool MaximumSize="ImageAndTextNormal" Id="TabItem4Group1Combo3" Width="150" Height="10" AllowMultipleSelection="True" CheckBoxVisibility="Visible"></local:XamComboEditorTool> </ig:HorizontalRibbonToolContainer> </ig:VerticalRibbonToolContainer> </ig:XamRibbonGroup> </ig:XamRibbonTabItem>
You could use ButtonGroup for this purpose. See the attached sample for an example.
Please note that there is a known bug with the ButtonGroup inversing the order in which the tools are displayed in the Ribbon Group. If you take a look at the XAML, you'll see that I defined the ComboTool after the ButtonGroup, but it appears above it.
i modified the code to use this property
MaximumSize="ImageAndTextNormal" in TabItem3.
But still controls are not arranged as expected.
this is what i am looking for:
Buttons are supposed to be arranged horizontally below the combobox. but this is not happening...can you please let me know if i am still missing some thing?