Background of readonly text fields

This commit is contained in:
Holger Börchers 2020-07-03 22:09:37 +02:00
parent 3bc68801b7
commit 03f3a96de0
2 changed files with 27 additions and 9 deletions

View File

@ -10,6 +10,15 @@
<ui:ThemeResources /> <ui:ThemeResources />
<ui:IntellisenseResources Source="/ModernWpf;component/DesignTime/DesignTimeResources.xaml" /> <ui:IntellisenseResources Source="/ModernWpf;component/DesignTime/DesignTimeResources.xaml" />
<ui:XamlControlsResources /> <ui:XamlControlsResources />
<ResourceDictionary>
<Style BasedOn="{StaticResource {x:Type TextBox}}" TargetType="TextBox">
<Style.Triggers>
<Trigger Property="IsReadOnly" Value="True">
<Setter Property="Background" Value="{DynamicResource SystemControlDisabledChromeMediumLowBrush}" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>

View File

@ -59,7 +59,6 @@
<ColumnDefinition Width="{Binding ElementName=Window, Path=(ui:TitleBar.SystemOverlayLeftInset), Converter={StaticResource PixelsToGridLength}}" /> <ColumnDefinition Width="{Binding ElementName=Window, Path=(ui:TitleBar.SystemOverlayLeftInset), Converter={StaticResource PixelsToGridLength}}" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Menu <Menu
Grid.Column="1" Grid.Column="1"
@ -112,18 +111,11 @@
<!-- Horizontally centered title --> <!-- Horizontally centered title -->
<TextBlock <TextBlock
Grid.Column="0" Grid.Column="0"
Grid.ColumnSpan="4" Grid.ColumnSpan="3"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
FontSize="13" FontSize="13"
Text="{Binding ElementName=Window, Path=Title}" /> Text="{Binding ElementName=Window, Path=Title}" />
<ui:PersonPicture
Grid.Column="3"
Height="24"
Margin="0,0,150,0"
DisplayName="Holger Börchers"
ToolTip="Holger Börchers"
WindowChrome.IsHitTestVisibleInChrome="True" />
</Grid> </Grid>
<!-- Footer --> <!-- Footer -->
<Grid <Grid
@ -250,6 +242,23 @@
Label="Good bye" Label="Good bye"
Symbol="x²" Symbol="x²"
Value="{Binding ValidationTest, UpdateSourceTrigger=PropertyChanged}" /> Value="{Binding ValidationTest, UpdateSourceTrigger=PropertyChanged}" />
<Grid Margin="0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ui:ToggleSwitch
x:Name="Switch"
Grid.Column="0"
Margin="0,0,5,0"
OffContent="Read/Write"
OnContent="ReadOnly" />
<TextBox
x:Name="SimpleTextBox"
Grid.Column="1"
IsReadOnly="{Binding IsOn, ElementName=Switch}"
Text="Eine einfache Textbox" />
</Grid>
<controls:PropertyPresenter Label="Hello" Value="{Binding BooleanValue}" /> <controls:PropertyPresenter Label="Hello" Value="{Binding BooleanValue}" />
<controls:PropertyPresenter Label="Hello"> <controls:PropertyPresenter Label="Hello">
<Slider <Slider