小编Zac*_*son的帖子

如何防止WPF GridSplitter改变网格的大小?

WPF GridSplitter让我的网格比我的窗口宽!

我有一个带有GridSplitter的WPF网格.如果我调整列的大小,那么我可以使网格比窗口宽,不可见.

它是这样开始的:

WPF网格http://img201.imageshack.us/img201/9505/onehg6.jpg

但在扩大左栏后,我再也看不到右栏(绿色):

WPF GridSplitter http://img201.imageshack.us/img201/1804/twomy6.jpg

我究竟做错了什么?如何防止GridSplitter改变网格的大小?


更新:

我还在努力解决这个问题.我现在尝试在网格中嵌套网格.这没有用.这是我的XAML ColumnDefinitions,RowDefinitions和GridSplitters ......

<Window ... >
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" MinWidth="150" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" MinWidth="400" />
        </Grid.ColumnDefinitions>
        <GridSplitter 
            ResizeDirection="Columns"
            ResizeBehavior="BasedOnAlignment"
            Grid.Column="1"
            HorizontalAlignment="Center"
            VerticalAlignment="Stretch"
            Width="2"
            Margin="0,5,0,5"
            Panel.ZIndex="1"/>
        <Grid Grid.Column="0">
            ...
        </Grid>
        <Grid Grid.Column="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" MinWidth="150" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" MinWidth="200" />
            </Grid.ColumnDefinitions>
            <GridSplitter 
                ResizeDirection="Columns"
                ResizeBehavior="PreviousAndNext"
                Grid.Column="1"
                HorizontalAlignment="Center"
                VerticalAlignment="Stretch"
                Width="2"
                Margin="0,5,0,5"
                Panel.ZIndex="1"/>
            <Grid Grid.Column="0">
                ...
            </Grid>
            <Grid Grid.Column="2">
                ...
            </Grid>
        </Grid>
    </Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)

更新: …

.net wpf grid xaml

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

如何在.NET中生成GIF图像?

是否有一个.NET库我可以用来以编程方式生成我自己的GIF图像?

至少我想逐个像素地构建它.更好的是支持文本和形状.

这是我正在尝试做的一个例子.我在Photoshop中嘲笑了这个...

数字线图形http://img143.imageshack.us/img143/5458/dollarlineot9.gif

您有什么推荐的吗?

.net image gif image-generation

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

目标文件夹访问被拒绝 - 您需要获得执行此操作的权限

有时我在尝试移动,重命名或以其他方式操作计算机上的某些文件或文件夹时会收到此错误消息...

目标文件夹访问被拒绝您需要获得执行此操作的权限http://img222.imageshack.us/img222/1581/destinationfolderaccessms9.jpg

我需要做些什么才能获得控制权?

windows

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

如何让Windows资源管理器在"缩略图"视图中显示我的文件预览?

我正在制作3D编辑器,我希望Windows资源管理器在缩略图视图模式下显示文件中3D模型的预览.

我怎么做?

winapi windows-explorer

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

WPF:"类型'String'的值无法转换为'System.Windows.Media.ImageSource'."

我正在尝试设置WPF图像的来源.

XAML的工作原理:

<Image Name="ImageThing"
       Source="images/Thing.png"/>
Run Code Online (Sandbox Code Playgroud)

Visual Basic失败:

ImageThing.Source = "images/Thing.png"
Run Code Online (Sandbox Code Playgroud)

......有这个例外:

"String"类型的值无法转换为"System.Windows.Media.ImageSource".

如何创建我需要的System.Windows.Media.ImageSource?


更新

此代码改编自MSDN示例:

Dim bmp As New BitmapImage()
bmp.BeginInit()
bmp.UriSource = New Uri("images/Thing.png", UriKind.Relative)
bmp.EndInit()
ImageThing.Source = bmp
Run Code Online (Sandbox Code Playgroud)

.net data-binding wpf image

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

EntityKey和ApplyPropertyChanges()

我需要设置一个EntityObject的EntityKey.我知道它的类型和它的id值.我不想不必要地查询数据库.

这有效......

//
// POST: /Department/Edit/5

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(Guid id, Department Model)
{
    Model.EntityKey = (from Department d in db.Department
                       where d.Id == id
                       select d).FirstOrDefault().EntityKey;
    db.ApplyPropertyChanges(Model.EntityKey.EntitySetName, Model);
    db.SaveChanges();
    return RedirectToAction("Index");
}
Run Code Online (Sandbox Code Playgroud)

这失败了......

//
// POST: /Department/Edit/5

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(Guid id, Department Model)
{
    String EntitySetName = db.DefaultContainerName + "." + Model.GetType().Name;
    Model.EntityKey = new System.Data.EntityKey(EntitySetName, "Id", Model.Id);
    db.ApplyPropertyChanges(Model.EntityKey.EntitySetName, Model);
    db.SaveChanges();
    return RedirectToAction("Index");
}
Run Code Online (Sandbox Code Playgroud)

ApplyPropertyChanges()线路出现故障与此异常:

ObjectStateManager不包含ObjectStateEntry,其中引用了"Sample.Models.Department"类型的对象.

两个EntityKeys是平等的.为什么第二块代码失败?我该如何解决?

.net c# asp.net-mvc entity-framework

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

嵌套的UpdatePanel触发器

我的孩子UpdatePanel更新其内容及其父UpdatePanel的内容.

<asp:UpdatePanel ID="UpdatePanel1" 
                 runat="server">
    ...
    <asp:UpdatePanel ID="UpdatePanel2" 
                     runat="server">
        ...
    </asp:UpdatePanel>
    ...
</asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)

我不希望每次子更新时都更新我的父UpdatePanel.

.net asp.net ajax updatepanel asp.net-ajax

6
推荐指数
2
解决办法
7925
查看次数

IIS 7上的.NET Framework 1.1

我继承了一个.NET Framework 1.1网站,我必须在Windows Server 2008上使用IIS 7托管.我遇到了一些麻烦.

1.安装

我按照这些说明安装了.NET Framework 1.1 .

安装程序自动创建一个新的应用程序池"ASP.NET 1.1".我用它.

麻烦

当我启动网站时,我看到web.config运行时错误:

标记包含"culture"属性的无效值.

我解决了那个,然后看到:

不允许子节点.

我不想继续玩这个打鼹鼠的游戏.有些事情一定是错的.

我确定这是.NET 1.1吗?

我检查自动创建的应用程序池.我看到它是1.1.

高级设置...

自动AppPool .NET 1.1高级版

基本设置...

自动AppPool .NET 1.1 Basic

这似乎不对.

设置1.1时,它不是高级下拉选择器中的选项.

为什么在Basic框中它只是"v1.1"而不是".NET Framework v1.1.4322"?那会更加一致.

4.我无法创建其他.NET 1.1应用程序池

我无法为其他应用程序池选择.NET Framework 1.1.它不是下拉选择器中的一个选项.那是怎么回事?

应用程序池缺少.NET 1.1选项

现在怎么办?

  • 为什么v1.1不是所有AppPools的选项?
  • 如何验证我的应用程序实际上是否使用.NET Framework 1.1?
  • 为什么我会收到这些运行时错误?

.net-1.1 iis-7 asp.net-1.1

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

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

如何在ASP.NET中最好地填充HTML表?

这就是我所拥有的.有用.但是,有更简单或更好的方法吗?

ASPX页面......

<asp:Repeater ID="RepeaterBooks" runat="server">
    <HeaderTemplate>
        <table class="report">
            <tr>
                <th>Published</th>
                <th>Title</th>
                <th>Author</th>
                <th>Price</th>
            </tr>
    </HeaderTemplate>
    <ItemTemplate>
            <tr>
                <td><asp:Literal ID="LiteralPublished" runat="server" /></td>
                <td><asp:Literal ID="LiteralTitle" runat="server" /></td>
                <td><asp:Literal ID="LiteralAuthor" runat="server" /></td>
                <td><asp:Literal ID="LiteralPrice" runat="server" /></td>
            </tr>
    </ItemTemplate>
    <FooterTemplate>
        </table>
    </FooterTemplate>
</asp:Repeater>
Run Code Online (Sandbox Code Playgroud)

ASPX.VB代码背后......

Protected Sub Page_Load( ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim db As New BookstoreDataContext
    RepeaterBooks.DataSource = From b In db.Books _
                               Order By b.Published _
                               Select b
    RepeaterBooks.DataBind()
End Sub

Sub RepeaterBooks_ItemDataBound( ByVal sender As Object, …
Run Code Online (Sandbox Code Playgroud)

html vb.net asp.net

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