小编Tri*_*ped的帖子

是否有可用于确定SQL Server备份或还原过程进度的SQL脚本?

当我使用MS SQL Server Management Studio备份或恢复数据库时,我可以直观地看到进程进展的程度,以及我还需要等待多长时间才能完成.如果我用脚本开始备份或恢复,有没有办法监控进度,或者我只是坐下来等待它完成(希望没有出错?)

编辑:我的需要是能够完全独立于启动备份或恢复的会话监视备份或恢复进度.

sql-server backup restore

92
推荐指数
7
解决办法
20万
查看次数

Listview XAML中的备用背景色

我正在使用基于itemTemplate的listView.所以我需要在我的模板中交替背景颜色:
- 第一行:白色
- 第二行:灰色
- 第三行:白色
- 第四行:灰色

这是我的模板:

     <DataTemplate x:Key="ItemFlight" >
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="60"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Border Background="#28AADB" Margin="2">
                <Image Source="{Binding Path=IsArrival, Converter={StaticResource BooleanToImageDisplayConverter}}" Width="30" Height="30" VerticalAlignment="Center" Margin="5"/>
            </Border>
            <Grid Grid.Column="1" VerticalAlignment="Center">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="4*"/>
                    <ColumnDefinition Width="3*"/>
                    <ColumnDefinition Width="3*"/>
                    <ColumnDefinition Width="6*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <TextBlock Text="{Binding FlightName}" FontWeight="Bold" Grid.Column="0" Grid.Row="0"  Margin="10" Style="{StaticResource MyTextBlockStyle}"/>

                <TextBlock Text="{Binding ArrivalOrDepartDateTime, Converter={StaticResource DateTimeConverter}}"  FontWeight="Bold" Grid.Column="0" Grid.Row="1" Margin="10" Style="{StaticResource MyTextBlockStyle}"/>

                <TextBlock Text="{Binding Terminal, Converter={StaticResource StringUpperConverter}}" Grid.Column="1" Grid.Row="0" Margin="10" …
Run Code Online (Sandbox Code Playgroud)

silverlight wpf xaml listview microsoft-metro

20
推荐指数
2
解决办法
3万
查看次数

AutomationProperties.Name VS x:名称

AutomationProperties.Name和之间的"CodedUI测试构建器"没有区别x:Name.但第一个可以覆盖第二个.此外,AtomationProperties.Name支持数据绑定,x:Name当然不支持.

我们知道如果您使用MVVM模式,最好只x:Name在需要时使用.

所以应该AutomationProperties.Name优先考虑x:Name

.net silverlight wpf accessibility ui-automation

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

如何在Outlook中预览代码附件?

我经常发送或接收带有源代码附件(.c,.cpp,.h,.js等)的邮件.如果我可以在Outlook中预览这些文件会更容易,所以我不需要在另一个应用程序中打开.
优选地,预览将包括语法突出显示,类似于Visual Studio.是否有适用于Outlook的Visual Studio预览插件?

我使用Visual Studio 2010 pro和MS Office 2007 Pro +

email outlook syntax-highlighting attachment preview

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

使用可绑定集合启用ScrollViewer Horizo​​ntalSnapPoints

我正在尝试从Windows 8 SDK示例中创建与ScrollViewerSample类似的体验,以便能够在向左和向右滚动时捕捉到ScrollViewer内的项目.样本(有效)的实现是这样的:

<ScrollViewer x:Name="scrollViewer" Width="480" Height="270"
              HorizontalAlignment="Left" VerticalAlignment="Top"
              VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" 
              ZoomMode="Disabled" HorizontalSnapPointsType="Mandatory">
    <StackPanel Orientation="Horizontal">
        <Image Width="480" Height="270" AutomationProperties.Name="Image of a cliff" Source="images/cliff.jpg" Stretch="None"  HorizontalAlignment="Left" VerticalAlignment="Top"/>
        <Image Width="480" Height="270" AutomationProperties.Name="Image of Grapes" Source="images/grapes.jpg" Stretch="None" HorizontalAlignment="Left" VerticalAlignment="Top"/>
        <Image Width="480" Height="270" AutomationProperties.Name="Image of Mount Rainier" Source="images/Rainier.jpg" Stretch="None" HorizontalAlignment="Left" VerticalAlignment="Top"/>
        <Image Width="480" Height="270" AutomationProperties.Name="Image of a sunset" Source="images/sunset.jpg" Stretch="None" HorizontalAlignment="Left" VerticalAlignment="Top"/>
        <Image Width="480" Height="270" AutomationProperties.Name="Image of a valley" Source="images/valley.jpg" Stretch="None" HorizontalAlignment="Left" VerticalAlignment="Top"/>
    </StackPanel>
</ScrollViewer>
Run Code Online (Sandbox Code Playgroud)

与我期望的实现的唯一区别是我不希望StackPanel内部有项目,但是我可以绑定它.我试图用ItemsControl完成这个,但由于某种原因,Snap行为没有启动:

<ScrollViewer x:Name="scrollViewer" Width="480" Height="270"
              HorizontalAlignment="Left" VerticalAlignment="Top"
              VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" …
Run Code Online (Sandbox Code Playgroud)

xaml windows-8 winrt-xaml

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

无法将附加属性绑定到另一个依赖项属性

我在写一个控制库.在这个库中有一些自定义面板,其中填充了用户UIElements.由于我的lib中的每个子元素都必须具有"Title"属性,因此我写了以下内容:

// Attached properties common to every UIElement
public static class MyLibCommonProperties
{
    public static readonly DependencyProperty TitleProperty =
        DependencyProperty.RegisterAttached( 
            "Title", 
            typeof(String),
            typeof(UIElement), 
            new FrameworkPropertyMetadata(
                "NoTitle", new PropertyChangedCallback(OnTitleChanged))
            );

    public static string GetTitle( UIElement _target )
    {
        return (string)_target.GetValue( TitleProperty );
    }

    public static void SetTitle( UIElement _target, string _value )
    {
        _target.SetValue( TitleProperty, _value );
    }

    private static void OnTitleChanged( DependencyObject _d, DependencyPropertyChangedEventArgs _e )
    {
       ...
    }
}
Run Code Online (Sandbox Code Playgroud)

然后,如果我写这个:

<dl:HorizontalShelf>
    <Label dl:MyLibCommonProperties.Title="CustomTitle">1</Label>
    <Label>1</Label>
    <Label>2</Label>
    <Label>3</Label>
</dl:HorizontalShelf>
Run Code Online (Sandbox Code Playgroud)

一切正常,属性获取指定的值,但如果我尝试将该属性绑定到其他一些UIElement DependencyProperty,如下所示: …

c# wpf xaml binding attached-properties

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

ListView被选中

我有一个listview,我xaml填充这样的项目:

List<DataLayer.Models.Dictionary> dicts = DataLayer.Manager.getDictionaries();

if (dicts != null)
{
    foreach (DataLayer.Models.Dictionary dict in dicts)
    {
         this.itemListView.Items.Add(dict);
    }
}
Run Code Online (Sandbox Code Playgroud)

我的DataLayer.Models.Dictionary对象有一个isSelected属性以及a Name和a SubName.

名称和子名称在模板中工作正常,但如何在用户单击项目时获取项目并进行更新?

谢谢!

编辑:

我的xaml现在看起来像这样,但项目仍未选中

    <ListView
        x:Name="itemListView"
        TabIndex="1"
        Grid.Row="1"
        Margin="0,60,0,0"
        Padding="0,0,0,0"
        IsSwipeEnabled="False"
        ScrollViewer.VerticalScrollBarVisibility="Hidden"
        SelectionChanged="itemListView_SelectionChanged_1"
        SelectionMode="Multiple"
        FontFamily="Global User Interface">
        <ListView.ItemContainerStyle>
            <Style TargetType="ListViewItem">
                <Setter Property="IsSelected" Value="{Binding Source=Selected,Mode=TwoWay}"/>
            </Style>
        </ListView.ItemContainerStyle>
        <ListView.ItemTemplate>
            <DataTemplate>
                <Grid Margin="6">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Grid.Column="0" Margin="0,0,0,0">
                        <TextBlock Text="{Binding Name}"/>
                        <TextBlock Text="{Binding SubName}" Style="{StaticResource CaptionTextStyle}" TextWrapping="Wrap"/>
                    </StackPanel>
                </Grid>
            </DataTemplate>
        </ListView.ItemTemplate> …
Run Code Online (Sandbox Code Playgroud)

c# xaml windows-8 winrt-xaml

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

尝试处理多维数据集但在模拟信息中获取错误

我在Business Development Intelligent Studio(BIDS)中使用名为'Test_cube'的数据库构建了一个多维数据集,该数据库由Products维度表,客户维度表和订单事实表组成.
products表属性:prodID-primary key,prodname,prodtype,prodcost
customers表属性:custID-primary key,custname,custloc
orders表属性:orderID,prodID,custID,quantity,unitprice,totalprice-calculated查询列其中primary key设置为orderID,prodID,custID

但是在尝试部署多维数据集时遇到了一些错误

内部错误:操作终止失败.
数据源"Test_cube"包含处理操作不支持的ImpersonationMode.
高级关系引擎中的错误.无法使用DataSourceID为"Test_cube",名称为"Test_cube"的数据源建立连接.
OLAP存储引擎中的错误:正在处理具有"产品"ID,"产品"名称的维度时发生错误.
OLAP存储引擎中的错误:正在处理来自"Test_cube"数据库的"产品"维度的"prodID"属性时发生错误.
服务器:当前操作已取消,因为事务中的另一个操作失败.

sql bids ssas-2008

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

将ListBox绑定到XAML中的List(Collection)

我正在学习WPF,所以我对此非常感兴趣.我看到了一些关于如何做我想做的事的例子,但没有确切的......

问题:我想将List绑定到ListBox.我想在XAML中完成它,没有编码后面的代码.我怎样才能做到这一点?

现在我做的那样:

XAML

<ListBox x:Name="FileList">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <Label Content="{Binding Path=.}"/>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)

代码背后

public MainWindow()
{
    // ...
    files = new List<string>();
    FileList.ItemsSource = files;
}

private void FolderBrowser_TextChanged(object sender, RoutedEventArgs e)
{
    string folder = FolderBrowser.Text;
    files.Clear();
    files.AddRange(Directory.GetFiles(folder, "*.txt", SearchOption.AllDirectories));
    FileList.Items.Refresh();
}
Run Code Online (Sandbox Code Playgroud)

但我想摆脱FileList.ItemsSource = files;,并FileList.Items.Refresh();在C#代码.

谢谢

c# wpf xaml binding wpf-controls

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

从客户端对象API访问TFS团队查询

有没有办法通过TFS 2013客户端对象API按名称运行共享团队查询

我正在研究一个C#脚本,它将根据共享团队查询的结果进行一些工作.我不想在TFS用户界面和脚本中维护查询; 我宁愿只运行我的团队使用的注册查询,但只是玩结果.当我写"注册查询"时,我只是指我在TFS UI中编写并保存为共享查询的查询.

换句话说:我想使用TFS UI创建查询,将文件保存在我的"共享查询"列表中,将其命名为"foo",然后从我的脚本中的客户端对象API访问foo.

我看到有一个GetQueryDefinition(GUID)方法WorkItemStore,但我会在哪里获得GUID共享团队查询?

c# tfs tfs2013

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