小编Oma*_*Mir的帖子

从MVVM中的DataGrid或ListBox绑定到SelectedItems

在底部看到我的答案

只是在WPF上做一些轻量级阅读,我需要从DataGrid绑定selectedItems,但我无法想出任何有形的东西.我只需要选定的对象.

数据网格:

<DataGrid Grid.Row="5" 
    Grid.Column="0" 
    Grid.ColumnSpan="4" 
    Name="ui_dtgAgreementDocuments"
    ItemsSource="{Binding Path=Documents, Mode=TwoWay}"
    SelectedItem="{Binding Path=DocumentSelection, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
    HorizontalAlignment="Stretch" 
    VerticalAlignment="Stretch" 
    Background="White"
    SelectionMode="Extended" Margin="2,5" 
    IsReadOnly="True" 
    CanUserAddRows="False" 
    CanUserReorderColumns="False" 
    CanUserResizeRows="False"
    GridLinesVisibility="None" 
    HorizontalScrollBarVisibility="Hidden"
    columnHeaderStyle="{StaticResource GreenTea}" 
    HeadersVisibility="Column" 
    BorderThickness="2" 
    BorderBrush="LightGray" 
    CellStyle="{StaticResource NonSelectableDataGridCellStyle}"
    SelectionUnit="FullRow" 
    HorizontalContentAlignment="Stretch" AutoGenerateColumns="False">
Run Code Online (Sandbox Code Playgroud)

c# vb.net wpf xaml mvvm

18
推荐指数
10
解决办法
4万
查看次数

router-link-active Nuxt 3 / VueJS 嵌套路由不适用于父级

我创建了一个简单的复制品以更好地解释自己。我有:

-| pages/
---| test/
------| index.vue
------| nested.vue
Run Code Online (Sandbox Code Playgroud)

我有一个导航栏,阅读了文档后,我假设如果我 NuxtLink 到/test/test/nested.vue然后我会将router-link-activecss 类应用于导航栏中的两者,但它似乎没有这样做。

该文档似乎建议您应该将内容布局为:

-| pages/
---| parent/
------| child.vue
---| parent.vue
Run Code Online (Sandbox Code Playgroud)

我尝试过,但不起作用 - 孩子永远不会被渲染(除非我<NuxtPage>向parent.vue添加另一个,这不是我想要的,因为这会显示父母和孩子的内容。

此处复制:https ://stackblitz.com/edit/nuxt-app-config-t3nvjv?file=app.vue

非常感谢您的帮助。

javascript vue.js vue-router nuxt.js nuxtjs3

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

正确的方法来更新MVVM模式中的记录以获得最大效率

这是一个概念性问题.这是我目前的困境; 我正在编写一个vb.net WPF应用程序并使用MVVM模式(喜欢它!可维护性非常棒).目前所有代码都是手工编写的,没有使用NHibernate或Entity Framework,因为后端是一个访问数据库(由于策略我不能使用NH和EF不支持JET数据库,我们可能会在某些时候切换到MSSQL但从现在开始可能还需要一段时间).

应用程序运行良好,并想知道将更新发送回数据库的最佳方法是什么.

目前的方法是将模型的set部分上的记录添加一个布尔值为"脏"然后当按下更新时,我们遍历所有"脏"的记录并使用oledbcommand(用参数执行)sql语句来更新.

这创造了一个很好的关注点分离,但如果这是错误的方式我想知道替代方案(请注意数据库类型和相关的缺点,如它不适用于EF).

谢谢!

评论后的VB.NET中的最终代码:

Public Class Car
Implements ICloneable

Public Property Make() As String
    Get
        Return m_Make
    End Get
    Set(ByVal value As String)
        m_Make = value
    End Set
End Property
Private m_Make As String

Public Property Model() As String
    Get
        Return m_Model
    End Get
    Set(ByVal value As String)
        m_Model = value
    End Set
End Property
Private m_Model As String

Public Function Clone() As Object Implements System.ICloneable.Clone
    Return New Car() With { _
     .Make = Me.Make, …
Run Code Online (Sandbox Code Playgroud)

c# vb.net mvvm visual-studio

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

创建Stormpath用户并在一次调用中分配给组

我想向组提交用户创建请求,但不确定如何在express-stormpath中执行此操作.

现在我使用注册前和注册后处理程序来获取一个字段,从formData中删除它,传递给res,然后在post registration handler上设置组:

preRegistrationHandler: function (formData, req, res, next) {
    res.locals.describes = formData.describes;
    delete formData.describes;

    next();
},

postRegistrationHandler: function (account, req, res, next) {
    var seekerHref = config.SEEKERS_HREF;
    var employerHref = config.EMPLOYERS_HREF;

    if (res.locals.describes === "seeker") {
        //Adding to seeker group
        account.addToGroup(seekerHref, function(err, membership) {
            console.log(membership);
        });
    } else if (res.locals.describes === "employers") {
        //Adding to the employer group
        account.addToGroup(employerHref, function(err, membership) {
            console.log(membership);
        });
    }
    delete res.locals.describes;

    next();
}
Run Code Online (Sandbox Code Playgroud)

这似乎不是一个好主意.如果连接不可用且组分配失败会发生什么?用户可能在没有组的情况下陷入困境.

node.js express stormpath express-stormpath

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

是否正确实施了 IEquatable?我应该总是重写 GetHashCode 吗?

我看到这里提出的问题:我是否正确实现了 Equals()/GetHashCode()?但我的 C# 不是那么强大,而且我对 IEquatable 不太熟悉,如果可能的话,我希望在 VB.NET 中看到它。

我的示例代码(当我到达那里时,该类最终将使用 INotifyPropertyChanged):

Public Class Car
Implements ICloneable
Implements IEquatable(Of Car)

Public Property Make() As String
    Get
        Return m_Make
    End Get
    Set(ByVal value As String)
        m_Make = value
    End Set
End Property
Private m_Make As String

Public Property Model() As String
    Get
        Return m_Model
    End Get
    Set(ByVal value As String)
        m_Model = value
    End Set
End Property
Private m_Model As String

Public Function Clone() As Object Implements System.ICloneable.Clone
    Return New Car() …
Run Code Online (Sandbox Code Playgroud)

vb.net iequatable

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

XAML,WPF和Windows 8

我希望有人在这里可以向我解释WPF和XAML之间的区别:

我有一个使用MVVM和Repository Pattern在VB.NET中编写的应用程序(特别是XBAP),实现了通常的INotifyPropertyChanged,OLEDB等.

应用程序的前端是用XAML编写的.

根据我的理解,没有关于此应用程序的具体"WPF".在我看来它的XAML + VB.NET; WPF在哪里?鉴于Windows 8和我一直听到的"Silverlight/WPF的死亡",我应该做些什么来"升级"我的应用程序以确保其未来?

我非常感谢有人为我清理这种困惑.

windows wpf xaml xbap

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

ListBox选定的文本颜色

当天的第二个问题,但希望很简单,我只需要更改列表框控件中所选项目的前景色.

我有以下样式(在选择时更改背景而不是前景颜色):

    <Style TargetType="ListBoxItem" x:Key="PinnedListBoxItem">
    <Style.Resources>
        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#FF9CC164"/>
        <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#FF9CC164"/>
        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="White"/>
    </Style.Resources>
</Style>
Run Code Online (Sandbox Code Playgroud)

这也行不通

    <Style TargetType="ListBoxItem" x:Key="PinnedListBoxItem">
    <Style.Resources>
        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#FF9CC164"/>
        <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="#FF9CC164"/>
    </Style.Resources>
    <Style.Triggers>
        <Trigger Property="IsSelected" Value="True">
            <Setter Property="Foreground" Value="White"/>
        </Trigger>
    </Style.Triggers>
</Style>
Run Code Online (Sandbox Code Playgroud)

我有以下ListBox:

                <ListBox Style="{StaticResource PinnedList}" Height="Auto" MaxHeight="200" Visibility="Hidden" HorizontalAlignment="Left" Margin="-8,45,0,0" SelectionChanged="ui_lsbPinnedORGs_SelectionChanged"
                     SelectedItem="{Binding Path=SelectedPinnedORGsViewModel, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True, Mode=TwoWay}"
                     SelectionMode="Single" ItemsSource="{Binding Path=ORGViewModels, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True, NotifyOnTargetUpdated=True, Mode=TwoWay}"
                     ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto" MouseEnter="ui_lsbPinnedORGs_MouseEnter"
                     VerticalAlignment="Top" Width="158" Name="ui_lsbPinnedORGs" ItemContainerStyle="{StaticResource PinnedListBoxItem}">
                <ListBox.ItemTemplate>
                    <HierarchicalDataTemplate>
                        <Label Content="{Binding Path=ORG.Acronym, …
Run Code Online (Sandbox Code Playgroud)

wpf xaml visual-studio-2010 visual-studio

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

带有AWAIT的Windows Phone 8异步JSON

我正在尝试为Windows Phone 8编写一个库,并想知道是否可以使用await关键字而不使用回调来使用JSON?或者我误解了它是如何工作的?

基本上我希望应用程序能够说:

string result = Library.Ping(var1, var2);
Run Code Online (Sandbox Code Playgroud)

该库连接到Web服务,并将内容从JSON反序列化为动态对象.然后它将它返回到已将请求发送到库的主应用程序.

c# asynchronous async-await windows-phone-8

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

删除列表项底部的边框

在此输入图像描述

红色突出部分!我该如何删除它?渲染列表的代码如下:

<s:List id="ui_lstIndexList" width="175" height="600" fontFamily="TwinCen"
                fontSize="24"
                alternatingItemColors="[]" borderVisible="false" downColor="#7fceff"
                change="showAlert(event)" contentBackgroundColor="#6fa8bc" color="#FFFFFF"
                dataProvider="{indexArrayCollection}" selectionColor="#7fceff">
            <s:itemRenderer>
                <fx:Component>
                    <s:IconItemRenderer labelField="name" messageField="artist"/>
                </fx:Component>
            </s:itemRenderer>
        </s:List>
Run Code Online (Sandbox Code Playgroud)

谢谢!!!

apache-flex air adobe mxml

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