Skip to content

Commit 9857194

Browse files
committed
Build complete BitmapScalingMode enum list using ObjectDataProvider
1 parent 1d4ce8d commit 9857194

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

CefSharp.Wpf.Example/Views/BrowserTabView.xaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf" xmlns:local="clr-namespace:CefSharp.Wpf.Example.ViewModels"
6+
xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
7+
xmlns:local="clr-namespace:CefSharp.Wpf.Example.ViewModels"
8+
xmlns:system="clr-namespace:System;assembly=mscorlib"
79
mc:Ignorable="d"
810
d:DesignWidth="640"
911
d:DesignHeight="480"
1012
d:DataContext="{d:DesignInstance local:BrowserTabViewModel}">
1113
<UserControl.Resources>
1214
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
15+
<ObjectDataProvider x:Key="BitmapScalingModeEnum" MethodName="GetValues" ObjectType="{x:Type system:Enum}">
16+
<ObjectDataProvider.MethodParameters>
17+
<x:Type TypeName="BitmapScalingMode"/>
18+
</ObjectDataProvider.MethodParameters>
19+
</ObjectDataProvider>
1320
</UserControl.Resources>
1421
<Grid>
1522
<DockPanel>
@@ -79,16 +86,9 @@
7986
Content="Bitmap Scaling Mode:" />
8087
<ComboBox Grid.Row="2"
8188
Grid.Column="1"
82-
Name="scalingModeCB"
83-
SelectedIndex="0">
84-
<ComboBox.ItemsSource>
85-
<x:Array Type="BitmapScalingMode">
86-
<BitmapScalingMode>NearestNeighbor</BitmapScalingMode>
87-
<BitmapScalingMode>LowQuality</BitmapScalingMode>
88-
<BitmapScalingMode>HighQuality</BitmapScalingMode>
89-
</x:Array>
90-
</ComboBox.ItemsSource>
91-
</ComboBox>
89+
Name="scalingModeComboBox"
90+
ItemsSource="{Binding Source={StaticResource BitmapScalingModeEnum}}"
91+
SelectedIndex="1"/>
9292
</Grid>
9393
</GroupBox>
9494
<GroupBox Header="Execute Javascript (asynchronously)">
@@ -190,7 +190,7 @@
190190
Title="{Binding Title, Mode=OneWayToSource}"
191191
AllowDrop="True"
192192
WebBrowser="{Binding WebBrowser, Mode=OneWayToSource}"
193-
RenderOptions.BitmapScalingMode="{Binding ElementName=scalingModeCB, Path=SelectedItem}">
193+
RenderOptions.BitmapScalingMode="{Binding ElementName=scalingModeComboBox, Path=SelectedItem}">
194194
<!-- Just an example of how you may override the BrowserSettings. Disabled by default since it looks so
195195
incredibly ugly... -->
196196
<!--<cefSharp:ChromiumWebBrowser.BrowserSettings>

0 commit comments

Comments
 (0)