Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RibbonGallery disabled in .net 4.6

I'm creating an application using RibbonController in WPF.

It's working fine until i installed .net 4.6. Then my "RibbonGallery" is disabled state (Viewpoints Drop Down menu) . I tried to enable through Code also but no luck ;(.

<Custom:RibbonGallery SelectedValue="Entrancelobby" SelectedValuePath="Content" ScrollViewer.VerticalScrollBarVisibility="Visible" MaxHeight="500">
        <Custom:RibbonGalleryCategory Name="viewpointsList" FontFamily="Times New Roman" FontSize="14">  
              <Custom:RibbonGalleryItem Content="Entrancelobby" Foreground="Black" />
              <Custom:RibbonGalleryItem Content="Entrancelobby 01" Foreground="Black"/> 
        <Custom:RibbonGalleryCategory>
</Custom:RibbonGallery>

See attachments No issue with 4.5 .Net 4.5 (Working)

.Net 4.6 (issue) enter image description here

Thanks in advance...

like image 665
Satish Avatar asked Dec 16 '15 07:12

Satish


Video Answer


2 Answers

This is actually a bug in RibbonGallery that just happens to be exposed by new logic in 4.6.1. The bug is that RG doesn't initialize its internal state correctly, so that if anyone calls CoerceValue(IsEnabledProperty) it coerces the value to false (i.e. disables the gallery). For example, calling ribbonGallery.IsEnabled = true; will actually disable the RG (even in 4.0).

.Net 4.6.1 has better logic for propagating IsEnabled to descendants. This logic ends up calling ribbonGallery.CoerceValue(IsEnabledProperty), which disables the RG due to the bug.

There's a workaround: Change the RG's Command. This causes the RG to reset its internal state correctly, so that future coercions do the right thing. For example:

ribbonGallery.Command = ApplicationCommands.Print;   // arbitrary command
ribbonGallery.Command = null;                        // don't keep the command
like image 81
Sam Bent - MSFT Avatar answered Sep 30 '22 04:09

Sam Bent - MSFT


Disabled items in RibbonGallery is the same issue I’m getting, once IsEnabled is set to false I can’t enable again. This was working previously and noticed since updating to Net 4.6 on the PC. I’ve run an old program from a few years back without any recompilation and it suffers from the same fate. So even if Net 4.5 is targeted it will exhibit the same problem as it’s associated to the PC .Net installed. If the PC uses Windows 10 the Net framework can’t be rolled back to Net 4.5 as it uses 4.6 minimum right?

Tried setting the Command to null but this was unsuccessful. Tried Net 4.6.1 installed on PC and various combinations targeted but unsuccessful. For me I think I’ll rip out the Microsoft ribbon stuff which has always seemed a buggy afterthought costing me in development time.

like image 21
Moon Waxing Avatar answered Sep 30 '22 03:09

Moon Waxing