File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed
Fluent.Ribbon.Tests/Converters Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 3588
3588
</GroupBox >
3589
3589
<GroupBox Header =" Issue repros" >
3590
3590
<WrapPanel >
3591
+ <WrapPanel .Resources>
3592
+ <Fluent : ObjectToImageConverter x : Key =" StringToImageConvert" />
3593
+ </WrapPanel .Resources>
3591
3594
<Fluent : Button x : Name =" SleepButton"
3592
3595
VerticalAlignment =" Top"
3593
3596
Click =" SleepButton_OnClick"
3602
3605
Change theme from thread
3603
3606
</Fluent : Button >
3604
3607
3608
+ <Fluent : Button VerticalAlignment =" Top"
3609
+ Tag =" /Images/Blue.png"
3610
+ Icon =" {Binding Path=Tag,RelativeSource={RelativeSource Self},Converter={StaticResource StringToImageConvert}}"
3611
+ Size =" Middle" >
3612
+ ObjectToImageConverter for issue #1152
3613
+ </Fluent : Button >
3614
+
3605
3615
<GroupBox Header =" KeyTip issues #254" >
3606
3616
<StackPanel Orientation =" Vertical" >
3607
3617
<formsInterop : WindowsFormsHost >
Original file line number Diff line number Diff line change @@ -41,4 +41,35 @@ public void TestDynamicResource()
41
41
Assert . That ( drawingGroup . Children . Cast < GeometryDrawing > ( ) . Select ( x => x . Geometry . ToString ( ) ) ,
42
42
Is . EquivalentTo ( ( ( DrawingGroup ) ( ( DrawingImage ) Application . Current . FindResource ( fluentRibbonImagesApplicationmenuResourceKey ) ) . Drawing ) . Children . Cast < GeometryDrawing > ( ) . Select ( x => x . Geometry . ToString ( ) ) ) ) ;
43
43
}
44
- }
44
+
45
+ private class DummyProvider : IServiceProvider
46
+ {
47
+ object IServiceProvider . GetService ( Type serviceType )
48
+ {
49
+ return null ;
50
+ }
51
+ }
52
+
53
+ [ Test ]
54
+ public void TestStaticResourceSequnece ( )
55
+ {
56
+ var fluentRibbonImagesApplicationmenuResourceKey = ( object ) "Fluent.Ribbon.Images.ApplicationMenu" ;
57
+
58
+ var expressionType = typeof ( ResourceReferenceExpressionConverter ) . Assembly . GetType ( "System.Windows.ResourceReferenceExpression" ) ;
59
+
60
+ var expression = Activator . CreateInstance ( expressionType , fluentRibbonImagesApplicationmenuResourceKey ) ;
61
+
62
+ var converter = new ObjectToImageConverter ( ) ;
63
+
64
+ converter . ProvideValue ( new DummyProvider ( ) ) ;
65
+
66
+ var convertedValue = StaticConverters . ObjectToImageConverter . Convert ( new object [ ]
67
+ {
68
+ expression , // value to convert
69
+ new ApplicationMenu ( ) // target visual
70
+ } , null , null , null ) ;
71
+
72
+ Assert . That ( convertedValue , Is . Not . Null ) ;
73
+ Assert . That ( convertedValue , Is . InstanceOf < Image > ( ) ) ;
74
+ }
75
+ }
You can’t perform that action at this time.
0 commit comments