code_style: remove xaml warnings

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo
2026-01-09 17:10:25 +08:00
parent 749be04f0b
commit 807d80d1fa
8 changed files with 20 additions and 27 deletions

View File

@@ -2,7 +2,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:m="using:SourceGit.Models"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:c="using:SourceGit.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"

View File

@@ -2,7 +2,6 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:m="using:SourceGit.Models"
xmlns:c="using:SourceGit.Converters"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:v="using:SourceGit.Views"

View File

@@ -49,10 +49,6 @@
ContextRequested="OnCommitListContextRequested"
DoubleTapped="OnCommitListDoubleTapped"
KeyDown="OnCommitListKeyDown">
<DataGrid.Resources>
<SolidColorBrush x:Key="DataGridGridLinesBrush" Color="{DynamicResource Color.Border0}" />
</DataGrid.Resources>
<DataGrid.Styles>
<Style Selector="DataGrid.static_scrollbar">
<Style Selector="^ /template/ DataGridRowsPresenter#PART_RowsPresenter">
@@ -62,6 +58,9 @@
<Style Selector="^ /template/ DataGridColumnHeadersPresenter#PART_ColumnHeadersPresenter">
<Setter Property="Grid.Column" Value="0" />
</Style>
<Style Selector="^ /template/ Rectangle#PART_ColumnHeadersAndRowsSeparator">
<Setter Property="Fill" Value="{DynamicResource Brush.Border0}"/>
</Style>
<Style Selector="^ /template/ ScrollBar">
<Setter Property="Background" Value="{DynamicResource Brush.Contents}"/>
</Style>

View File

@@ -70,7 +70,7 @@
<Border Grid.Row="2" Margin="8,0,8,8" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
<Grid RowDefinitions="*,3,*">
<v:InteractiveRebaseListBox Grid.Row="0"
x:Name="IRItemListBox"
x:Name="ItemListBox"
Focusable="True"
Background="{DynamicResource Brush.Contents}"
ItemsSource="{Binding Items}"

View File

@@ -172,7 +172,7 @@ namespace SourceGit.Views
{
CloseOnESC = true;
InitializeComponent();
IRItemListBox?.Focus();
ItemListBox?.Focus();
}
public void OpenCommitMessageEditor(ViewModels.InteractiveRebaseItem item)
@@ -206,7 +206,7 @@ namespace SourceGit.Views
if (isFirstTimeHere)
_firstSelectionChangedHandled = true;
var selected = IRItemListBox.SelectedItems ?? new List<object>();
var selected = ItemListBox.SelectedItems ?? new List<object>();
var items = new List<ViewModels.InteractiveRebaseItem>();
foreach (var item in selected)
{
@@ -230,10 +230,10 @@ namespace SourceGit.Views
return;
var builder = new StringBuilder();
var selected = IRItemListBox.SelectedItems ?? new List<object>();
var selected = ItemListBox.SelectedItems ?? new List<object>();
if (selected.Count > 0 && !selected.Contains(item))
{
IRItemListBox.SelectedItem = item;
ItemListBox.SelectedItem = item;
builder.Append(item.Commit.SHA).Append(';');
}
else
@@ -252,7 +252,7 @@ namespace SourceGit.Views
private void OnRowDragOver(object sender, DragEventArgs e)
{
if (DataContext is not ViewModels.InteractiveRebase vm)
if (DataContext is not ViewModels.InteractiveRebase)
return;
if (e.DataTransfer.TryGetValue(_dndItemFormat) is not { Length: > 0 } hashes)
@@ -294,7 +294,7 @@ namespace SourceGit.Views
if (hashes.IndexOf(dst.Commit.SHA, StringComparison.Ordinal) >= 0)
return;
var selected = IRItemListBox.SelectedItems ?? new List<object>();
var selected = ItemListBox.SelectedItems ?? new List<object>();
if (selected.Count == 0)
return;
@@ -310,7 +310,7 @@ namespace SourceGit.Views
}
vm.Move(commits, before ? idx : idx + 1);
IRItemListBox.SelectedItems = commits;
ItemListBox.SelectedItems = commits;
dst.DropDirectionIndicator = new Thickness(0);
e.DragEffects = DragDropEffects.None;
@@ -322,7 +322,7 @@ namespace SourceGit.Views
if (DataContext is not ViewModels.InteractiveRebase vm)
return;
if (IRItemListBox.SelectedItems is not { Count: > 0 } selected)
if (ItemListBox.SelectedItems is not { Count: > 0 } selected)
return;
var hashes = new HashSet<string>();
@@ -347,7 +347,7 @@ namespace SourceGit.Views
}
vm.Move(items, idx);
IRItemListBox.SelectedItems = items;
ItemListBox.SelectedItems = items;
e.Handled = true;
}
@@ -356,7 +356,7 @@ namespace SourceGit.Views
if (DataContext is not ViewModels.InteractiveRebase vm)
return;
if (IRItemListBox.SelectedItems is not { Count: > 0 } selected)
if (ItemListBox.SelectedItems is not { Count: > 0 } selected)
return;
var hashes = new HashSet<string>();
@@ -381,7 +381,7 @@ namespace SourceGit.Views
}
vm.Move(items, idx);
IRItemListBox.SelectedItems = items;
ItemListBox.SelectedItems = items;
e.Handled = true;
}
@@ -461,7 +461,7 @@ namespace SourceGit.Views
menuItem.Icon = new Ellipse() { Width = 14, Height = 14, Fill = iconBrush };
menuItem.Header = header;
menuItem.Tag = hotkey;
menuItem.Click += (_, __) => ChangeItemsAction(item, action);
menuItem.Click += (_, _) => ChangeItemsAction(item, action);
flyout.Items.Add(menuItem);
}
@@ -471,7 +471,7 @@ namespace SourceGit.Views
if (DataContext is not ViewModels.InteractiveRebase vm)
return;
var selected = IRItemListBox.SelectedItems ?? new List<object>();
var selected = ItemListBox.SelectedItems ?? new List<object>();
var items = new List<ViewModels.InteractiveRebaseItem>();
foreach (var item in selected)
{
@@ -491,7 +491,7 @@ namespace SourceGit.Views
OpenCommitMessageEditor(items[0]);
}
private bool _firstSelectionChangedHandled = false;
private bool _firstSelectionChangedHandled;
private readonly DataFormat<string> _dndItemFormat = DataFormat.CreateStringApplicationFormat("sourcegit-dnd-ir-item");
}
}

View File

@@ -47,7 +47,7 @@
v:AutoFocusBehaviour.IsEnabled="True">
<TextBox.InnerLeftContent>
<Border Height="22" CornerRadius="10" Margin="4,0,0,0" Background="Green">
<TextBlock Grid.Column="0" x:Name="TxtPrefix" Text="REMOTE" Foreground="White" Margin="8,0"/>
<TextBlock x:Name="TxtPrefix" Text="REMOTE" Foreground="White" Margin="8,0"/>
</Border>
</TextBox.InnerLeftContent>
</TextBox>

View File

@@ -4,7 +4,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:v="using:SourceGit.Views"
xmlns:c="using:SourceGit.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.RenameBranch"
x:DataType="vm:RenameBranch">

View File

@@ -381,10 +381,7 @@
<TextBox Grid.Row="5" Margin="0,4,0,0" CornerRadius="3" Height="28" Text="{Binding URLTemplate, Mode=TwoWay}"/>
<TextBlock Grid.Row="6" Margin="0,2,0,0" Text="{DynamicResource Text.Configure.IssueTracker.URLTemplate.Tip}" Foreground="{DynamicResource Brush.FG2}"/>
<CheckBox Grid.Row="7" Grid.Column="1"
Margin="0,4,0,0"
Content="{DynamicResource Text.Configure.IssueTracker.Share}"
IsChecked="{Binding IsShared, Mode=TwoWay}"/>
<CheckBox Grid.Row="7" Margin="0,4,0,0" Content="{DynamicResource Text.Configure.IssueTracker.Share}" IsChecked="{Binding IsShared, Mode=TwoWay}"/>
</Grid>
</DataTemplate>
</ContentControl.DataTemplates>