如何创建一个从左到右格式化的字符串?
string.Format("{0:00-00-0000}", 123);
Run Code Online (Sandbox Code Playgroud)
上面的回报就像00-00-0123我希望的那样12-30-0000
任何想法实现这一目标?
如何从 DataRow 的 PropertyDescriptor 获取其 PropertyInfo。
//pd is a PropertyDescriptor
var propertyinfo = pd.ComponentType.GetProperty(pd.Name);
Run Code Online (Sandbox Code Playgroud)
上面的代码适用于列表集合,但在使用 DataTable 时则不起作用。
对此有什么想法吗?
按钮Foreground在启用时应用.如果设置为已禁用,则Foreground需要应用默认按钮的禁用.
<Button Width="150"
Height="50"
Content="Test"
Foreground="Red"
IsEnabled="False" />
Run Code Online (Sandbox Code Playgroud)
我有这个按钮的触发器
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="#FFADADAD"/>
</Trigger>
Run Code Online (Sandbox Code Playgroud)
Foreground启用时不会应用此选项.
有什么想法吗?
需要如下,


我想知道Xamarin带有所有应用程序包的Mono运行时.在这种情况下,如果两个基于Xamarin的应用程序安装在一个设备中,它将具有两个Mono运行时权限.这是Xamarin的限制吗?
在Xamarin项目中,Android - 我是android开发的新手.在处理活动时,在OnCreate方法中为a设置自定义适配器ListView.
protected async override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView(Resource.Layout.Main);
var listAdapter = new CustomListAdapter(this);
//.................................................
listView = (ListView) FindViewById(Resource.Id.list);
// populate the listview with data
listView.Adapter = listAdapter;
}
Run Code Online (Sandbox Code Playgroud)
在ctor适配器中,在异步调用中创建项列表.
public CustomListAdapter(Activity context) //We need a context to inflate our row view from
: base()
{
this.context = context;
// items is List<Product>
items = await GetProductList();
}
Run Code Online (Sandbox Code Playgroud)
由于Getproducts是异步调用,因此它将异步加载数据.
问题是,一旦我将适配器设置为列表,它将尝试调用GetView适配器的方法.那时,不会加载项目.所以有一个空的例外.
如何处理这种情况.
谢谢.
我正在尝试ContextMenu为 a创建一个ListBox。它只应该在ListBoxItem通过单击鼠标右键选择 a时显示。但是ContextMenu只要在其中完成右键单击ListBox,即使它是空的,也会打开。
这是我的代码:
<Window x:Class="WpfApplication4.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
Width="525"
Height="350">
<Grid>
<ListBox Name="listIn"
Width="148"
Height="175"
Margin="25,52,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
ItemsSource="{Binding Path=groupid}"
SelectionChanged="listBox1_SelectionChanged"
SelectionMode="Extended" />
<ListBox Name="listOut"
Width="148"
Height="175"
Margin="335,52,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
MouseRightButtonDown="ListBoxItem_MouseRightButtonDown"
SelectedItem="listBox2_SelectionChanged"
SelectionChanged="listBox2_SelectionChanged"
SelectionMode="Extended">
<ListBox.ContextMenu>
<ContextMenu>
<MenuItem Header="update" />
<MenuItem Header="delete" />
</ContextMenu>
</ListBox.ContextMenu>
</ListBox>
<Button Name="cmdRein"
Width="75"
Height="23"
Margin="215,75,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Click="button1_Click"
Content="moveRight" />
<Button Name="cmdRaus"
Width="75"
Height="23"
Margin="217,0,0,145"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
Click="button2_Click"
Content="moveLeft" />
<Button Name="button1"
Width="59"
Height="23" …Run Code Online (Sandbox Code Playgroud) 更新VS和XCode后得到此错误。
Error MT5306: Failed to create the a fat library. Please review the build log.
c# ×3
xamarin ×3
wpf ×2
xamarin.ios ×2
android ×1
async-await ×1
asynchronous ×1
datatable ×1
propertyinfo ×1
string ×1