1
0
Fork 0
mirror of https://github.com/wagesj45/butterflow-ui.git synced 2024-12-22 01:02:43 -06:00

Conditional XAML

This commit is contained in:
Jordan Wages 2018-06-24 23:26:28 -05:00
parent 7fde16539f
commit 19c04c363e
5 changed files with 65 additions and 11 deletions

View file

@ -14,11 +14,24 @@ namespace butterflow_ui
public string LabelValue { get; set; }
public string DescriptionValue { get; set; }
public Visibility ToolTipVisibility
{
get
{
//return string.IsNullOrWhiteSpace(this.DescriptionValue) ? Visibility.Hidden : Visibility.Visible;
return Visibility.Hidden;
}
}
#endregion
#region Dependency Properties
public static DependencyProperty LabelValueProperty = DependencyProperty.Register("LabelValue", typeof(string), typeof(ButterflowOption));
public static DependencyProperty DescriptionValueProperty = DependencyProperty.Register("DescriptionValue", typeof(string), typeof(ButterflowOption));
public static DependencyProperty ToolTipVisibilityProperty = DependencyProperty.Register("ToolTipVisibility", typeof(Visibility), typeof(ButterflowOption));
#endregion

View file

@ -13,7 +13,13 @@
</Grid.ColumnDefinitions>
<Label Grid.Column="0" VerticalAlignment="Center" Content="{TemplateBinding LabelValue}" />
<ContentControl Grid.Column="1" VerticalAlignment="Center" Content="{TemplateBinding Content}" />
<Label x:Name="TheLabel" Grid.Column="2" Visibility="Visible" ToolTip="{TemplateBinding DescriptionValue}" Content="?"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="DescriptionValue" Value="{x:Null}">
<Setter TargetName="TheLabel" Property="Visibility" Value="Hidden"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>

View file

@ -195,6 +195,15 @@ namespace butterflow_ui.Localization {
}
}
/// <summary>
/// Looks up a localized string similar to Some description of playback rate goes here..
/// </summary>
public static string PlaybackRateDescription {
get {
return ResourceManager.GetString("PlaybackRateDescription", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Playback Rate.
/// </summary>
@ -205,7 +214,16 @@ namespace butterflow_ui.Localization {
}
/// <summary>
/// Looks up a localized string similar to Video Scale / Resolution.
/// Looks up a localized string similar to Video Rendering.
/// </summary>
public static string RenderingLabel {
get {
return ResourceManager.GetString("RenderingLabel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Output Resolution.
/// </summary>
public static string ResolutionLabel {
get {

View file

@ -141,11 +141,17 @@
<data name="LosslessLabel" xml:space="preserve">
<value>Lossless Quality</value>
</data>
<data name="PlaybackRateDescription" xml:space="preserve">
<value>Some description of playback rate goes here.</value>
</data>
<data name="PlaybackRateLabel" xml:space="preserve">
<value>Playback Rate</value>
</data>
<data name="RenderingLabel" xml:space="preserve">
<value>Video Rendering</value>
</data>
<data name="ResolutionLabel" xml:space="preserve">
<value>Video Scale / Resolution</value>
<value>Output Resolution</value>
</data>
<data name="Title" xml:space="preserve">
<value>butterflow-ui</value>

View file

@ -11,10 +11,17 @@
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="_File">
//
<MenuItem Header="Derp" />
<MenuItem Header="Darp" />
<MenuItem Header="Dorp" />
</MenuItem>
<MenuItem Header="_Edit" />
<MenuItem Header="_Help" />
<MenuItem Header="_Help">
<MenuItem Header="More about butterflow..." />
<MenuItem Header="More about butterflow-ui..." />
<Separator />
<MenuItem Header="About" />
</MenuItem>
</Menu>
<Grid>
<Grid.RowDefinitions>
@ -44,7 +51,7 @@
<GroupBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Header="{x:Static loc:Localization.CommonOptionsGroupBox}">
<ScrollViewer>
<StackPanel>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.PlaybackRateLabel}">
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.PlaybackRateLabel}" >
<StackPanel Orientation="Vertical">
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._2xLabel}" Tag="2x" />
@ -67,16 +74,20 @@
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._120fpsLabel}" Tag="120" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.CustomPlaybackRateLabel}">
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.CustomPlaybackRateLabel}" DescriptionValue="{x:Static loc:Localization.PlaybackRateDescription}">
<TextBox Text="{Binding OptionsConfiguration.PlaybackRate, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" />
</butterflow_ui:ButterflowOption>
</StackPanel>
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.KeepAudioLabel}">
<CheckBox IsChecked="{Binding OptionsConfiguration.KeepAudio, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.LosslessLabel}">
<CheckBox IsChecked="{Binding OptionsConfiguration.LosslessQuality, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" />
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.RenderingLabel}">
<StackPanel>
<butterflow_ui:ButterflowOption LabelValue="">
<CheckBox IsChecked="{Binding OptionsConfiguration.KeepAudio, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Content="{x:Static loc:Localization.KeepAudioLabel}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="" DescriptionValue="Renders the video with no compression.">
<CheckBox IsChecked="{Binding OptionsConfiguration.LosslessQuality, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Content="{x:Static loc:Localization.LosslessLabel}" />
</butterflow_ui:ButterflowOption>
</StackPanel>
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.ResolutionLabel}">
<Grid>