Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions XamlStudio/Models/FileBackedDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ public abstract partial class FileBackedDocument : ObservableObject
/// </summary>
public string Title
{
get { return (HasChanged ? "*" : "") + field; }
set { SetProperty(ref field, value.Trim('*')); }
get => (HasChanged ? "*" : "") + field;
set => SetProperty(ref field, value.Trim('*'));
}

/// <summary>
/// Gets the file path as displayed for tooltips
/// </summary>
[JsonIgnore]
public string DisplayPath => BackingFile?.Path ?? Title;

//// TODO: This is effectively private, but needs to be serialized, investigate options when switching away from Newtonsoft
public string StorageToken { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion XamlStudio/Models/XamlDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public sealed partial class XamlDocument : FileBackedDocument
public partial DocumentState State { get; set; } = new DocumentState();

[JsonIgnore]
public string DisplayName { get { return BackingFile.DisplayName; } }
public string DisplayName => BackingFile?.DisplayName;

internal XamlDocument()
{
Expand Down
19 changes: 13 additions & 6 deletions XamlStudio/Views/Explorer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
<TextBlock HorizontalAlignment="Left"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the TextBlock ones, should we also add TextTrimming so that the filename is truncated more nicely?

VerticalAlignment="Center"
Style="{ThemeResource BodyTextBlockStyle}"
Text="{x:Bind ((storage:StorageFile)Content).Name}" />
Text="{x:Bind ((storage:StorageFile)Content).Name}"
ToolTipService.ToolTip="{x:Bind ((storage:StorageFile)Content).Name}" />
Comment thread
michael-hawker marked this conversation as resolved.
</StackPanel>
</DataTemplate>

Expand All @@ -43,7 +44,8 @@
<TextBlock HorizontalAlignment="Left"
VerticalAlignment="Center"
Style="{ThemeResource BodyTextBlockStyle}"
Text="{x:Bind ((storage:StorageFile)Content).Name}" />
Text="{x:Bind ((storage:StorageFile)Content).Name}"
ToolTipService.ToolTip="{x:Bind ((storage:StorageFile)Content).Name}" />
</StackPanel>
</DataTemplate>

Expand All @@ -55,7 +57,8 @@
<TextBlock HorizontalAlignment="Left"
VerticalAlignment="Center"
Style="{ThemeResource BodyTextBlockStyle}"
Text="{x:Bind ((storage:StorageFile)Content).Name}" />
Text="{x:Bind ((storage:StorageFile)Content).Name}"
ToolTipService.ToolTip="{x:Bind ((storage:StorageFile)Content).Name}" />
<!-- Show Hover Preview of Image -->
<ToolTipService.ToolTip>
<Image Width="128"
Expand All @@ -74,7 +77,8 @@
<TextBlock HorizontalAlignment="Left"
VerticalAlignment="Center"
Style="{ThemeResource BodyTextBlockStyle}"
Text="{x:Bind ((storage:StorageFile)Content).Name}" />
Text="{x:Bind ((storage:StorageFile)Content).Name}"
ToolTipService.ToolTip="{x:Bind ((storage:StorageFile)Content).Name}" />
</StackPanel>
</DataTemplate>

Expand All @@ -84,7 +88,8 @@
<TextBlock HorizontalAlignment="Left"
VerticalAlignment="Center"
Style="{ThemeResource BodyTextBlockStyle}"
Text="{x:Bind ((storage:StorageFolder)Content).DisplayName}" />
Text="{x:Bind ((storage:StorageFolder)Content).DisplayName}"
ToolTipService.ToolTip="{x:Bind ((storage:StorageFolder)Content).DisplayName}" />
</StackPanel>
</DataTemplate>

Expand Down Expand Up @@ -149,7 +154,9 @@
<TextBlock Margin="32,0"
VerticalAlignment="Center"
FontWeight="SemiBold"
Text="{Binding Title}" />
Text="{Binding Title}"
TextTrimming="CharacterEllipsis"
ToolTipService.ToolTip="{Binding DisplayPath}" />
<StackPanel Grid.Column="1"
ex:FrameworkElementExtensions.AncestorType="ListViewItem"
Orientation="Horizontal"
Expand Down
6 changes: 4 additions & 2 deletions XamlStudio/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,16 @@
</muxc:TabView.Resources>
<muxc:TabView.TabItemTemplate>
<DataTemplate x:DataType="models:XamlDocument">
<muxc:TabViewItem HorizontalContentAlignment="Stretch" ContextFlyout="{StaticResource TabItemFlyout}">
<muxc:TabViewItem HorizontalContentAlignment="Stretch"
ContextFlyout="{StaticResource TabItemFlyout}"
ToolTipService.ToolTip="{x:Bind DisplayPath, Mode=OneWay}">
<muxc:TabViewItem.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{x:Bind Title, Mode=OneWay}" />
<TextBlock Text="{x:Bind Title, Mode=OneWay}" TextTrimming="CharacterEllipsis" />
<controls:SwitchPresenter Grid.Column="1"
TargetType="models:SyncStatus"
Value="{x:Bind State.RenderState, Mode=OneWay}">
Expand Down