Skip to content

Commit

Permalink
[FZ Editor] Include template name in edit template dialog title + don…
Browse files Browse the repository at this point in the history
…'t resize dialog when typing to long name (#15187)

* Edit layout dialog title fix

* Added TextBlock in the contentdialog title to enable TextTrimming

* Fix text trimming and wrapping

* Too long name doesn't affect dialog width

Co-authored-by: niels9001 <niels.laute@live.nl>
  • Loading branch information
stefansjfw and niels9001 committed Dec 29, 2021
1 parent 54a3e67 commit b6affde
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,15 @@
PrimaryButtonText="{x:Static props:Resources.Save}"
PrimaryButtonClick="EditLayoutDialog_PrimaryButtonClick"
SecondaryButtonClick="EditLayoutDialog_SecondaryButtonClick"
Title="{x:Static props:Resources.Edit_Layout}"
ScrollViewer.VerticalScrollBarVisibility="Auto"
MaxWidth="320"
Opened="Dialog_Opened"
Closed="Dialog_Closed">
<ui:ContentDialog.Title>
<TextBlock x:Name="EditLayoutDialogTitle" MaxWidth="320" Margin="0,0,96,0" Loaded="EditLayoutDialogTitle_Loaded"/>
</ui:ContentDialog.Title>
<Grid DataContext="{Binding SelectedModel}"
MinWidth="320" Margin="4,4,24,32">
Margin="4,4,24,32">

<StackPanel Margin="0,-37,0,0"
HorizontalAlignment="Right"
Expand Down Expand Up @@ -423,6 +426,7 @@
Margin="12,0,0,0"
ui:ControlHelper.Header="{x:Static props:Resources.Name}"
MinWidth="286"
MaxWidth="286"
HorizontalAlignment="Stretch"
GotKeyboardFocus="TextBox_GotKeyboardFocus" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ private async void EditLayout_Click(object sender, RoutedEventArgs e)
}

Keyboard.ClearFocus();
EditLayoutDialogTitle.Text = string.Format(Properties.Resources.Edit_Template, ((LayoutModel)dataContext).Name);
await EditLayoutDialog.ShowAsync();
}

Expand Down Expand Up @@ -547,5 +548,11 @@ private void SettingsBtn_Click(object sender, RoutedEventArgs e)
{
SettingsDeepLink.OpenSettings(SettingsDeepLink.SettingsWindow.FancyZones);
}

private void EditLayoutDialogTitle_Loaded(object sender, EventArgs e)
{
EditLayoutDialogTitle.TextTrimming = TextTrimming.CharacterEllipsis;
EditLayoutDialogTitle.TextWrapping = TextWrapping.NoWrap;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@
<data name="QuickKey_Title" xml:space="preserve">
<value>Layout shortcut</value>
</data>
<data name="Edit_Layout" xml:space="preserve">
<value>Edit layout</value>
<data name="Edit_Template" xml:space="preserve">
<value>Edit '{0}'</value>
</data>
<data name="Edit_Layout_Open_Announce" xml:space="preserve">
<value>opened</value>
Expand Down

0 comments on commit b6affde

Please sign in to comment.