小编San*_*ann的帖子

从左到右应用字符串格式

如何创建一个从左到右格式化的字符串?

string.Format("{0:00-00-0000}", 123);
Run Code Online (Sandbox Code Playgroud)

上面的回报就像00-00-0123我希望的那样12-30-0000

任何想法实现这一目标?

c# string

7
推荐指数
1
解决办法
251
查看次数

来自 PropertyDescriptor 的 DataRow 的 PropertyInfo

如何从 DataRow 的 PropertyDescriptor 获取其 PropertyInfo。

//pd is a PropertyDescriptor
var propertyinfo = pd.ComponentType.GetProperty(pd.Name);
Run Code Online (Sandbox Code Playgroud)

上面的代码适用于列表集合,但在使用 DataTable 时则不起作用。

对此有什么想法吗?

c# datatable propertyinfo propertydescriptor

5
推荐指数
1
解决办法
1962
查看次数

WPF - 默认按钮禁用样式时应用前景

按钮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启用时不会应用此选项.

有什么想法吗?

需要如下,

在此输入图像描述

在此输入图像描述

wpf

5
推荐指数
1
解决办法
2万
查看次数

Xamarin是否会为其所有应用程序提供运行时?

我想知道Xamarin带有所有应用程序包的Mono运行时.在这种情况下,如果两个基于Xamarin的应用程序安装在一个设备中,它将具有两个Mono运行时权限.这是Xamarin的限制吗?

xamarin.ios xamarin.android xamarin xamarin.forms

3
推荐指数
1
解决办法
43
查看次数

如何使用默认覆盖来处理异步和等待

在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适配器的方法.那时,不会加载项目.所以有一个空的例外.

如何处理这种情况.

谢谢.

c# android asynchronous async-await xamarin

2
推荐指数
1
解决办法
1257
查看次数

WPF 列表框项上下文菜单

我正在尝试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)

wpf

1
推荐指数
1
解决办法
2496
查看次数

错误MT5306:无法创建胖库。请查看构建日志

更新VS和XCode后得到此错误。

Error MT5306: Failed to create the a fat library. Please review the build log.

xamarin.ios xamarin

1
推荐指数
1
解决办法
749
查看次数