我在我的应用程序中进行排序,如下所示.
public IQueryable<Users> SelectAll(string sSortExpression, string sSortOrder)
{
if (sSortOrder == "asc")
{
switch (sSortExpression)
{
case "FirstName":
return UsersRepository.Entities.OrderBy(x => x.FirstName);
case "LastName":
return UsersRepository.Entities.OrderBy(x => x.LastName);
default:
return UsersRepository.Entities.OrderBy(x => x.Id);
}
}
else
{
switch (sSortExpression)
{
case "FirstName":
return UsersRepository.Entities.OrderByDescending(x => x.FirstName);
case "LastName":
return UsersRepository.Entities.OrderByDescending(x => x.LastName);
default:
return UsersRepository.Entities.OrderByDescending(x => x.UserName);
}
}
}
Run Code Online (Sandbox Code Playgroud)
它现在很好,但我必须对Users表中的所有字段(大约30个字段)进行排序.那么方法会很大
我尝试使用这样的反射
public IQueryable<Users> SelectAll(string sSortExpression, string sSortOrder)
{
var _property = UsersRepository.GetType().GetProperties().Where(a => a.Name == …Run Code Online (Sandbox Code Playgroud) 问题
我有两个字符串s1和s2
string s1 = " characters of a string, creating a new string object. An array U.A.E of characters is passed to this method to U.A.E specify U.A.E the characters to be removed. The order of the elements in the character array does not affect the trim operation.";
string s2 = " An array UAE of characters is passed to this method to UAE specify UAE " ;
Run Code Online (Sandbox Code Playgroud)
我在标签中显示字符串s1.并希望在s1中加粗s2部分.
即, label1.Text = " characters of a string, creating a …
<Window x:Class="TestringWpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Background="Yellow"></StackPanel>
<StackPanel Grid.Row="1" Background="Green">
<Button Margin="0,0,0,10000000000">ABC</Button>
</StackPanel>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
上面的代码将给我以下情况:

正如您所看到的,按钮在第二个时间被声明,StackPanel因此无论我如何设置边距,按钮都无法退出绿色背景.我想知道我该怎么做才能宣布按钮<StackPanel Grid.Row="1">并部分显示<StackPanel Grid.Row="0">.
总之,如何使元素在其容器中溢出并在另一个容器上重叠?可能吗?