Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5
Enable MenuTool bound to empty collection
posted

Hi.
I'm trying to use the MenuTool to present a list of attachments. So my scenario is as follows:
segmented MenuTool, bound to ShowAttachments commmand, with its items bound to some collection, as follows:

<ir:MenuTool ir:RibbonGroup.MaximumSize="ImageAndTextLarge"
ButtonType="Segmented"
LargeImage="{StaticResource sampleIcon1}"
Command="{Binding SectionDetails.ShowAttachmentsCommand}"
ItemsSource="{Binding SectionDetails.AttachmentsViewModel.SectionAttachments}"
ItemTemplate="{StaticResource attchmentMenuItemTemplate}">
<ir:MenuTool.ToolTip>
<ToolTip>
<TextBlock Text="{Binding SectionDetails.AttachmentCount, StringFormat={}{0} attachment(s)}"/>
</ToolTip>
</ir:MenuTool.ToolTip>
</ir:MenuTool>

with ItemTemplate defined as follows:

<DataTemplate x:Key="attchmentMenuItemTemplate">
<ir:ButtonTool Caption="{Binding FileName}" SmallImage="{Binding Image}" />
</DataTemplate>

Everything is working fine if I have some items in SectionDetails.AttachmentsViewModel.SectionAttachments. Problem emerges when the colletion is empty: MenuTool is disabled (both the drop list and the button), and I can't invoke the associated command. Is there any way to enable the MenuTool's button if it's bound collection is empty?
Regards.