mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
WIP Protect/Unprotect Additional Field on selection
This commit is contained in:
@@ -321,7 +321,6 @@
|
||||
<Flyout>
|
||||
<interactivity:Interaction.Behaviors>
|
||||
<core:DataTriggerBehavior Binding="{Binding Password}" ComparisonCondition="NotEqual" Value="" >
|
||||
<!--<actions:CloseFlyoutAction />-->
|
||||
<core:CallMethodAction MethodName="Hide" />
|
||||
</core:DataTriggerBehavior>
|
||||
</interactivity:Interaction.Behaviors>
|
||||
@@ -506,12 +505,12 @@
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox Grid.Row="0" Text="{Binding Name, Mode=TwoWay}" Width="350"
|
||||
<TextBox Grid.Row="0" Text="{Binding Path=DataContext.AdditionalFieldName, ElementName=Page, Mode=TwoWay}" Width="350"
|
||||
IsEnabled="{Binding Path=DataContext.IsCurrentEntry, ElementName=Page}" />
|
||||
<TextBox Grid.Row="1" AcceptsReturn="True" Height="100" TextWrapping="Wrap" Width="350" Margin="0,5,0,0"
|
||||
Text="{Binding Value, Mode=TwoWay}"
|
||||
Text="{Binding Path=DataContext.AdditionalFieldValue, ElementName=Page, Mode=TwoWay}"
|
||||
IsEnabled="{Binding Path=DataContext.IsCurrentEntry, ElementName=Page}" />
|
||||
<ToggleSwitch Grid.Row="2" x:Uid="EntryEnableFieldProtection" HorizontalAlignment="Left" IsOn="{Binding IsProtected, Mode=TwoWay}" />
|
||||
<ToggleSwitch Grid.Row="2" x:Uid="EntryEnableFieldProtection" HorizontalAlignment="Left" IsOn="{Binding Path=DataContext.AdditionalFieldIsProtected, ElementName=Page, Mode=TwoWay}" />
|
||||
<Button Grid.Row="2" x:Uid="EntryDeleteAdditionalField" HorizontalAlignment="Right" Margin="0,15,0,0" Command="{Binding Path=DataContext.DeleteAdditionalField, ElementName=Page}" CommandParameter="{Binding}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
|
@@ -7,8 +7,8 @@
|
||||
mc:Ignorable="d">
|
||||
<ComboBox x:Name="ComboBox"
|
||||
ItemsSource="{Binding Colors, ElementName=UserControl}"
|
||||
SelectionChanged="Selector_OnSelectionChanged"
|
||||
Loaded="ComboBox_Loaded"
|
||||
SelectedValue="{Binding SelectedColor, ElementName=UserControl, Mode=TwoWay}"
|
||||
SelectedValuePath="ColorBrush"
|
||||
IsEnabled="{Binding IsEnabled, ElementName=UserControl}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
@@ -46,16 +46,5 @@ namespace ModernKeePass.Views.UserControls
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void ComboBox_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ComboBox.SelectedItem = Colors.Find(c => c.ColorBrush.Color.Equals(SelectedColor.Color));
|
||||
}
|
||||
|
||||
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var selectedItem = ComboBox.SelectedItem as Color? ?? new Color();
|
||||
SelectedColor = selectedItem.ColorBrush;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user