mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(GUI): added dropdown list to settings widgets.
This commit is contained in:
@@ -58,6 +58,12 @@ IN THE SOFTWARE.
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
|
<ControlTemplate x:Key="BoundDropDownList" TargetType="ComboBox">
|
||||||
|
<StackPanel Orientation="Vertical" Margin="2" DataContext="{TemplateBinding DataContext}">
|
||||||
|
<TextBlock Text="{Binding Text}" ToolTip="{Binding Description}" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
|
||||||
|
<ComboBox ItemsSource="{Binding Path=Source.ValuesSet}" SelectedItem="{Binding Value, Mode=TwoWay}" Margin="0,4,0,0"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ControlTemplate>
|
||||||
|
|
||||||
<Style x:Key="ExpandCollapseToggleStyle" TargetType="ToggleButton">
|
<Style x:Key="ExpandCollapseToggleStyle" TargetType="ToggleButton">
|
||||||
<Setter Property="Focusable" Value="False"/>
|
<Setter Property="Focusable" Value="False"/>
|
||||||
|
|||||||
@@ -191,10 +191,20 @@ namespace GARbro.GUI
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UIElement CreateDropDownWidget (FixedSetSetting setting)
|
||||||
|
{
|
||||||
|
return new ComboBox {
|
||||||
|
Template = (ControlTemplate)this.Resources["BoundDropDownList"],
|
||||||
|
DataContext = CreateSettingView<object> (setting),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
UIElement CreateSettingWidget<TUnknown> (IResourceSetting setting, TUnknown value)
|
UIElement CreateSettingWidget<TUnknown> (IResourceSetting setting, TUnknown value)
|
||||||
{
|
{
|
||||||
if (setting is FixedGaugeSetting)
|
if (setting is FixedGaugeSetting)
|
||||||
return CreateGaugeWidget (setting as FixedGaugeSetting);
|
return CreateGaugeWidget (setting as FixedGaugeSetting);
|
||||||
|
if (setting is FixedSetSetting)
|
||||||
|
return CreateDropDownWidget (setting as FixedSetSetting);
|
||||||
if (value is bool)
|
if (value is bool)
|
||||||
return CreateCheckBoxWidget (setting);
|
return CreateCheckBoxWidget (setting);
|
||||||
if (value is Encoding)
|
if (value is Encoding)
|
||||||
|
|||||||
Reference in New Issue
Block a user