Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion .github/workflows/vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,31 @@ jobs:
ssh-key: ${{ secrets.VALE_STYLES_ACCESS_KEY }}
- name: copy vale rules to the root repo
run: shopt -s dotglob && cp -r ./vale-styles/vale/* .

- name: detect README file
id: detect
shell: bash
run: |
set -euo pipefail
found="$(find . -maxdepth 1 -type f -iname 'readme.md' -print | head -n 1 || true)"
if [[ -z "$found" ]]; then
echo "No README.md found in repo root. Nothing to lint."
echo "files=[]" >> "$GITHUB_OUTPUT"
exit 0
fi
found="${found#./}"
echo "Found README: $found"
echo "files=[\"$found\"]" >> "$GITHUB_OUTPUT"
- name: vale linter check
if: steps.detect.outputs.files != '[]'
uses: DevExpress/vale-action@reviewdog
with:
files: '["[Rr]eadme.md"]'
files: ${{ steps.detect.outputs.files }}
fail_on_error: true
filter_mode: nofilter
reporter: github-check
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @DevExpressExampleBot
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This code example is provided "as is" without warranty of any kind. Developer Express Inc ("DevExpress") disclaims all warranties,
either express or implied, including the warranties of merchantability and fitness for a particular purpose.

For licensing terms and conditions of DevExpress product(s) required for, or associated with the use of this code example,
please refer to the applicable End-User License Agreement at https://www.devexpress.com/Support/licensingfaq.xml
For terms and conditions governing use of DevExpress product libraries, including product libraries used in this sample,
please review the applicable DevExpress End-User License Agreement at the following address: https://www.devexpress.com/Support/licensingfaq.xml
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<!-- default badges list -->
![](https://img.shields.io/endpoint?url=https://codecentral.devexpress.com/api/v1/VersionRange/129903121/21.1.2%2B)
[![](https://img.shields.io/badge/Open_in_DevExpress_Support_Center-FF7200?style=flat-square&logo=DevExpress&logoColor=white)](https://supportcenter.devexpress.com/ticket/details/T830604)
[![](https://img.shields.io/badge/📖_How_to_use_DevExpress_Examples-e9f6fc?style=flat-square)](https://docs.devexpress.com/GeneralInformation/403183)
[![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives)
Expand All @@ -25,7 +24,7 @@ This example includes multiple solutions that demonstrate:

After you bind the Data Grid to a database, you can implement CRUD operations (create, read update, delete). View the example: [Implement CRUD Operations in the WPF Data Grid](https://github.com/DevExpress-Examples/how-to-implement-crud-operations).
<!-- feedback -->
## Does this example address your development requirements/objectives?
## Does This Example Address Your Development Requirements/Objectives?

[<img src="https://www.devexpress.com/support/examples/i/yes-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=wpf-data-grid-bind-to-pagedasyncsource&~~~was_helpful=yes) [<img src="https://www.devexpress.com/support/examples/i/no-button.svg"/>](https://www.devexpress.com/support/examples/survey.xml?utm_source=github&utm_campaign=wpf-data-grid-bind-to-pagedasyncsource&~~~was_helpful=no)

Expand Down
9 changes: 9 additions & 0 deletions VB/PagedAsyncSourceMVVMSample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="PagedAsyncSourceMVVMSample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PagedAsyncSourceMVVMSample"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
12 changes: 12 additions & 0 deletions VB/PagedAsyncSourceMVVMSample/App.xaml.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Imports System.Windows

Namespace PagedAsyncSourceMVVMSample

''' <summary>
''' Interaction logic for App.xaml
''' </summary>
Public Partial Class App
Inherits Application

End Class
End Namespace
58 changes: 26 additions & 32 deletions VB/PagedAsyncSourceMVVMSample/IssueFilterConverter.vb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Imports DevExpress.Data.Filtering
Imports DevExpress.Data.Filtering
Imports DevExpress.Xpf.Data
Imports System
Imports System.Globalization
Expand All @@ -7,36 +7,30 @@ Imports System.Windows.Data
Imports System.Windows.Markup

Namespace PagedAsyncSourceMVVMSample
Public Class IssueFilterConverter
Inherits MarkupExtension
Implements IValueConverter

Private Function IValueConverter_Convert(ByVal filter As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
Return DirectCast(filter, CriteriaOperator).Match(binary:= Function(propertyName, value, type)
If propertyName = "Votes" AndAlso type = BinaryOperatorType.GreaterOrEqual Then
Return New IssueFilter(minVotes:= CInt(Math.Truncate(value)))
End If
If propertyName = "Priority" AndAlso type = BinaryOperatorType.Equal Then
Return New IssueFilter(priority:= CType(value, Priority))
End If
If propertyName = "Created" Then
If type = BinaryOperatorType.GreaterOrEqual Then
Return New IssueFilter(createdFrom:= CDate(value))
End If
If type = BinaryOperatorType.Less Then
Return New IssueFilter(createdTo:= CDate(value))
End If
End If
Throw New InvalidOperationException()
End Function, [and]:= Function(filters)
Return New IssueFilter(createdFrom:= filters.Select(Function(x) x.CreatedFrom).SingleOrDefault(Function(x) x IsNot Nothing), createdTo:= filters.Select(Function(x) x.CreatedTo).SingleOrDefault(Function(x) x IsNot Nothing), minVotes:= filters.Select(Function(x) x.MinVotes).SingleOrDefault(Function(x) x IsNot Nothing), priority:= filters.Select(Function(x) x.Priority).SingleOrDefault(Function(x) x IsNot Nothing))
End Function, null:= CType(Nothing, IssueFilter))
End Function
Private Function IValueConverter_ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
Public Overrides Function ProvideValue(ByVal serviceProvider As IServiceProvider) As Object
Return Me
End Function
End Class
Public Class IssueFilterConverter
Inherits MarkupExtension
Implements IValueConverter

Private Function Convert(ByVal filter As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
Return CType(filter, CriteriaOperator).Match(binary:=Function(propertyName, value, type)
If Equals(propertyName, "Votes") AndAlso type = BinaryOperatorType.GreaterOrEqual Then Return New IssueFilter(minVotes:=CInt(value))
If Equals(propertyName, "Priority") AndAlso type = BinaryOperatorType.Equal Then Return New IssueFilter(priority:=CType(value, Priority))
If Equals(propertyName, "Created") Then
If type = BinaryOperatorType.GreaterOrEqual Then Return New IssueFilter(createdFrom:=CDate(value))
If type = BinaryOperatorType.Less Then Return New IssueFilter(createdTo:=CDate(value))
End If

Throw New InvalidOperationException()
End Function, [and]:=Function(filters) New IssueFilter(createdFrom:=filters.[Select](Function(x) x.CreatedFrom).SingleOrDefault(Function(x) x IsNot Nothing), createdTo:=filters.[Select](Function(x) x.CreatedTo).SingleOrDefault(Function(x) x IsNot Nothing), minVotes:=filters.[Select](Function(x) x.MinVotes).SingleOrDefault(Function(x) x IsNot Nothing), priority:=filters.[Select](Function(x) x.Priority).SingleOrDefault(Function(x) x IsNot Nothing)), null:=Nothing)
End Function

Private Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function

Public Overrides Function ProvideValue(ByVal serviceProvider As IServiceProvider) As Object
Return Me
End Function
End Class
End Namespace
134 changes: 72 additions & 62 deletions VB/PagedAsyncSourceMVVMSample/IssueService/IssueData.vb
Original file line number Diff line number Diff line change
@@ -1,65 +1,75 @@
Imports System
Imports System

Namespace PagedAsyncSourceMVVMSample
Public Class IssueData
Public Sub New(ByVal subject As String, ByVal user As String, ByVal created As DateTime, ByVal votes As Integer, ByVal priority As Priority)
Me.Subject = subject
Me.User = user
Me.Created = created
Me.Votes = votes
Me.Priority = priority
End Sub
Private privateSubject As String
Public Property Subject() As String
Get
Return privateSubject
End Get
Private Set(ByVal value As String)
privateSubject = value
End Set
End Property
Private privateUser As String
Public Property User() As String
Get
Return privateUser
End Get
Private Set(ByVal value As String)
privateUser = value
End Set
End Property
Private privateCreated As DateTime
Public Property Created() As DateTime
Get
Return privateCreated
End Get
Private Set(ByVal value As DateTime)
privateCreated = value
End Set
End Property
Private privateVotes As Integer
Public Property Votes() As Integer
Get
Return privateVotes
End Get
Private Set(ByVal value As Integer)
privateVotes = value
End Set
End Property
Private privatePriority As Priority
Public Property Priority() As Priority
Get
Return privatePriority
End Get
Private Set(ByVal value As Priority)
privatePriority = value
End Set
End Property
End Class
Public Enum Priority
Low
BelowNormal
Normal
AboveNormal
High
End Enum

Public Class IssueData

Private _Subject As String, _User As String, _Created As DateTime, _Votes As Integer, _Priority As Priority

Public Sub New(ByVal subject As String, ByVal user As String, ByVal created As System.DateTime, ByVal votes As Integer, ByVal priority As PagedAsyncSourceMVVMSample.Priority)
Me.Subject = subject
Me.User = user
Me.Created = created
Me.Votes = votes
Me.Priority = priority
End Sub

Public Property Subject As String
Get
Return _Subject
End Get

Private Set(ByVal value As String)
_Subject = value
End Set
End Property

Public Property User As String
Get
Return _User
End Get

Private Set(ByVal value As String)
_User = value
End Set
End Property

Public Property Created As DateTime
Get
Return _Created
End Get

Private Set(ByVal value As DateTime)
_Created = value
End Set
End Property

Public Property Votes As Integer
Get
Return _Votes
End Get

Private Set(ByVal value As Integer)
_Votes = value
End Set
End Property

Public Property Priority As Priority
Get
Return _Priority
End Get

Private Set(ByVal value As Priority)
_Priority = value
End Set
End Property
End Class

Public Enum Priority
Low
BelowNormal
Normal
AboveNormal
High
End Enum
End Namespace
98 changes: 53 additions & 45 deletions VB/PagedAsyncSourceMVVMSample/IssueService/IssueFilter.vb
Original file line number Diff line number Diff line change
@@ -1,48 +1,56 @@
Imports System
Imports System

Namespace PagedAsyncSourceMVVMSample
Public Class IssueFilter
Public Sub New(Optional ByVal priority? As Priority = Nothing, Optional ByVal createdFrom? As DateTime = Nothing, Optional ByVal createdTo? As DateTime = Nothing, Optional ByVal minVotes? As Integer = Nothing)
Me.Priority = priority
Me.CreatedFrom = createdFrom
Me.CreatedTo = createdTo
Me.MinVotes = minVotes
End Sub
Private privatePriority? As Priority
Public Property Priority() As Priority?
Get
Return privatePriority
End Get
Private Set(ByVal value? As Priority)
privatePriority = value
End Set
End Property
Private privateCreatedFrom? As DateTime
Public Property CreatedFrom() As DateTime?
Get
Return privateCreatedFrom
End Get
Private Set(ByVal value? As DateTime)
privateCreatedFrom = value
End Set
End Property
Private privateCreatedTo? As DateTime
Public Property CreatedTo() As DateTime?
Get
Return privateCreatedTo
End Get
Private Set(ByVal value? As DateTime)
privateCreatedTo = value
End Set
End Property
Private privateMinVotes? As Integer
Public Property MinVotes() As Integer?
Get
Return privateMinVotes
End Get
Private Set(ByVal value? As Integer)
privateMinVotes = value
End Set
End Property
End Class

Public Class IssueFilter

Private _Priority As PagedAsyncSourceMVVMSample.Priority?, _CreatedFrom As System.DateTime?, _CreatedTo As System.DateTime?, _MinVotes As Integer?

Public Sub New(ByVal Optional priority As PagedAsyncSourceMVVMSample.Priority? = Nothing, ByVal Optional createdFrom As System.DateTime? = Nothing, ByVal Optional createdTo As System.DateTime? = Nothing, ByVal Optional minVotes As Integer? = Nothing)
Me.Priority = priority
Me.CreatedFrom = createdFrom
Me.CreatedTo = createdTo
Me.MinVotes = minVotes
End Sub

Public Property Priority As PagedAsyncSourceMVVMSample.Priority?
Get
Return _Priority
End Get

Private Set(ByVal value As PagedAsyncSourceMVVMSample.Priority?)
_Priority = value
End Set
End Property

Public Property CreatedFrom As System.DateTime?
Get
Return _CreatedFrom
End Get

Private Set(ByVal value As System.DateTime?)
_CreatedFrom = value
End Set
End Property

Public Property CreatedTo As System.DateTime?
Get
Return _CreatedTo
End Get

Private Set(ByVal value As System.DateTime?)
_CreatedTo = value
End Set
End Property

Public Property MinVotes As Integer?
Get
Return _MinVotes
End Get

Private Set(ByVal value As Integer?)
_MinVotes = value
End Set
End Property
End Class
End Namespace
Loading