I'm losing data-bind when initiating a printing process, is that possible ? Thats what I can only think of in my situation here, where I have a Table inside a control that makes the Table data-bindable, all inside a FlowDocument. When running it the data-bind works fine and the table draws itself with some data on it with no problems.
However, when printing the output of that control is always blank.
I've added a ListView with the same bindings and when printing the generated data it too appears lost.
XAML:
<Window x:Class="GlassStore.InitBill"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:GlassStore.ViewModels"
xmlns:flowdocs="clr-namespace:FlowDocuments;assembly=FlowDocument"
Title="InitBill" Height="825" Width="1004">
<Window.DataContext>
<local:InitBillViewModel/>
</Window.DataContext>
<Grid Background="White">
<FlowDocumentReader HorizontalAlignment="Center"
HorizontalContentAlignment="Center">
<FlowDocument ColumnWidth="999999"
IsColumnWidthFlexible="True"
TextAlignment="Center"
Name="FD">
<Paragraph>
<ListView ItemsSource="{Binding GridTrans}">
<ListView.View>
<GridView>
<GridViewColumn Header="ffff"
DisplayMemberBinding="{Binding CarModel}" />
<GridViewColumn Header="xxxx"
DisplayMemberBinding="{Binding CarName}" />
</GridView>
</ListView.View>
</ListView>
</Paragraph>
<Paragraph TextAlignment="Center">
<TextBlock Text="{Binding test}" />
</Paragraph>
<flowdocs:ItemsContent ItemsSource="{Binding GridTrans}"
Background="#FFF2C3C3"
BorderThickness="2">
<flowdocs:ItemsContent.ItemTemplate>
<DataTemplate>
<flowdocs:Fragment>
<Table>
<TableRowGroup flowdocs:Attached.IsItemsHost="True">
<TableRow Background="AliceBlue" >
<TableCell Foreground="Red">
<Paragraph>
<flowdocs:BindableRun BoundText="{Binding CarName}" />
</Paragraph>
</TableCell>
<TableCell Foreground="Green">
<Paragraph>
<flowdocs:BindableRun BoundText="{Binding CarModel}" />
</Paragraph>
</TableCell>
<TableCell Foreground="Yellow">
<Paragraph>
<flowdocs:BindableRun BoundText="{Binding glassPrice}" />
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</flowdocs:Fragment>
</DataTemplate>
</flowdocs:ItemsContent.ItemTemplate>
</flowdocs:ItemsContent>
<Table>
<TableRowGroup>
<TableRow>
<TableCell>
<Paragraph>Row1 Cell1</Paragraph>
</TableCell>
<TableCell>
<Paragraph>Row2 Cell2</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</FlowDocument>
</FlowDocumentReader>
<Button Command="{Binding print}"
Content="إطـبع"
Height="29" Margin="91,0,112,41"
Name="button1"
VerticalAlignment="Bottom" />
</Grid>
</Window>
Now I know the problem is not with the Custom Control, because I have the same problem now with ListView.
I've attached the source to the Window version here and the printed version here.
The ViewModel would be nice, especially the method behind the print command. My guess ist, that the flowdocument is put into a special print context and loses the datacontext of the window.
Try removing
<Window.DataContext>
<local:InitBillViewModel/>
</Window.DataContext>
and use
<FlowDocumentReader HorizontalAlignment="Center" HorizontalContentAlignment="Center">
<FlowDocumentReader.DataContext>
<local:InitBillViewModel/>
</FlowDocumentReader.DataContext>
...
instead. Maybe that helps?
Edit: The print command would have to move to another ViewModel to still work, of course. This other ViewModel would stay where the old one was, in the Window.DataContext.
Here's my solution:
define the document in a separate XAML file:
Load the Flow Document from Resource Dictionary Xaml
then print:
var prntDlg = new PrintDialog();
var res = Application.LoadComponent(new Uri("/Resources/ReportDocument.xaml", UriKind.RelativeOrAbsolute)) as ResourceDictionary;
var doc = res["ReportFlowDoc"] as FlowDocument;
doc.DataContext = this.fdswReport.Document.DataContext; //your FlowDocumentScrollViewer
doc.PageWidth = prntDlg.PrintableAreaWidth;
doc.PageHeight = prntDlg.PrintableAreaHeight;
doc.ColumnWidth = prntDlg.PrintableAreaWidth;
doc.PagePadding = new Thickness(80);
doc.IsOptimalParagraphEnabled = true;
doc.IsHyphenationEnabled = true;
if (prntDlg.ShowDialog() == true)
prntDlg.PrintDocument(((IDocumentPaginatorSource)doc).DocumentPaginator, "Report");
Related
I want to be able to create "reports" as regular MVVM views, so to test this idea I created the following view. It just consists of a bound textblock, an ItemsControl (bound to a collection of a few hundred strings), and a second text block:
<UserControl ...>
<UserControl.Resources>
<DataTemplate x:Key="myListItemTemplate">
<TextBlock Text="{Binding}"
Foreground="Blue" />
</DataTemplate>
</UserControl.Resources>
<FlowDocument x:Name="flowDoc">
<BlockUIContainer>
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding Message}" />
<ItemsControl ItemsSource="{Binding SomeList}"
ItemTemplate="{StaticResource myListItemTemplate}" />
<TextBlock Text="THE END" />
</StackPanel>
</BlockUIContainer>
</FlowDocument>
</UserControl>
I print the view using a DocumentPaginator like this:
private void Print(IPrintableView view)
{
var dlg = new PrintDialog();
if (!dlg.ShowDialog().GetValueOrDefault())
{
return;
}
var paginator = new MyDocumentPaginator(
view.FlowDocument,
new Size(dlg.PrintableAreaWidth, dlg.PrintableAreaHeight),
new Size(DefaultMarginWidthDpi, DefaultMarginHeightDpi));
dlg.PrintDocument(paginator, "My print job");
}
Unsurprisingly the document isn't being paginated, and produce a 1-page report that gets truncated partway through the list. (I don't believe my document paginator implementation is important here, which simply adds a header and footer to each page, and I see the same issue if I use the FlowDocument's own FlowDocumentPaginator).
As I now understand it, document paginators will only break on "Block" controls, so I modified the xaml to wrap each control in a BlockUIContainer:
<UserControl ...>
<UserControl.Resources>
<DataTemplate x:Key="myListItemTemplate">
<TextBlock Text="{Binding}"
Foreground="Blue" />
</DataTemplate>
</UserControl.Resources>
<FlowDocument x:Name="flowDoc">
<BlockUIContainer>
<TextBlock Text="{Binding Message}" />
</BlockUIContainer>
<BlockUIContainer>
<ItemsControl ItemsSource="{Binding SomeList}"
ItemTemplate="{StaticResource myListItemTemplate}" />
</BlockUIContainer>
<BlockUIContainer>
<TextBlock Text="THE END" />
</BlockUIContainer>
</FlowDocument>
</UserControl>
Here, a page break now occurs after the first TextBlock, with the list starting on page 2 (but still being truncated at the end of that page), and the second textblock appearing on page 3.
I assume the paginator is measuring and rendering the entire ItemsControl as a whole, so I then tried placing each list item inside a BlockUIContainer via the ItemContainerStyle:
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<BlockUIContainer>
<ContentPresenter Content="{Binding}" />
</BlockUIContainer>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</ItemsControl.ItemContainerStyle>
This made no difference though. Is there a way to get this working? Am I even approaching this in the right way? Placing every UI control inside a "block" seems very cumbersome, especially when it the time comes to implement a real report containing a lot of complexity. The real reports won't necessarily be list based either, and are more likely to contain a mixture of controls - text, images, lists, etc. in a fairly free-style layout (more web page than banded report).
So this wasn't straightforward as I was expecting, and if it were not for stumbling across this article then I'd probably never have found a solution. In the article, the author has created a series of classes and controls including a "FlowDocument friendly" list, with the option of rendering it as a Table, meaning that page breaks will occur between the items' TableRows when necessary.
Here's my updated "report view" xaml. Note that I've also refactored the text by using a <Paragraph> rather than a TextBlock inside a BlockUIElement. You'll also notice that these Paragraphs are also bindable, via a custom BindableRun control that is also part of the above article:
<UserControl ...>
<FlowDocument x:Name="flowDoc"
TextElement.FontFamily="Arial">
<Paragraph Margin="0,0,0,20">
<flowDocuments:BindableRun BoundText="{Binding Message}" />
</Paragraph>
<flowDocuments:ItemsContent ItemsSource="{Binding SomeList}">
<flowDocuments:ItemsContent.ItemsPanel>
<DataTemplate>
<flowDocuments:Fragment>
<Table>
<Table.Columns>
<TableColumn Width="*" />
</Table.Columns>
<TableRowGroup flowDocuments:Attached.IsItemsHost="True">
<TableRow Background="LightBlue">
<TableCell>
<Paragraph>Heading</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</flowDocuments:Fragment>
</DataTemplate>
</flowDocuments:ItemsContent.ItemsPanel>
<flowDocuments:ItemsContent.ItemTemplate>
<DataTemplate>
<flowDocuments:Fragment>
<TableRow>
<TableCell>
<Paragraph>
<flowDocuments:BindableRun BoundText="{Binding}" />
</Paragraph>
</TableCell>
</TableRow>
</flowDocuments:Fragment>
</DataTemplate>
</flowDocuments:ItemsContent.ItemTemplate>
</flowDocuments:ItemsContent>
<Paragraph>THE END</Paragraph>
</FlowDocument>
</UserControl>
The custom ItemsContent control is used to render the list, and has a few familiar properties:
an ItemsSource property for binding to the VM's collection
an ItemTemplate property defining a DataTemplate that consists of a "Fragment" element (again from the above article), and within this a <TableRow> used to render the string items in my VM's collection
an ItemsPanel, used to define the "container" - in this case a Table control. This example includes a hardcoded TableRow used to display the column headings. I believe other containers are permitted such as a , although I didn't read the article in detail.
Anyway, it all appears to work, and produces a report that is correctly paginated, with the list of strings breaking to new pages at the correct places.
If anyone else uses the article to generate reports as I have done, be aware that the ItemsContent Loaded event never fires, resulting in the list not rendering (this is presumably due to the way I'm programmatically creating the view and/or not displaying it on screen). To get it working, I had to comment out the three if (IsLoaded) lines that appear later on in this class.
I am building flowdocument from ViewModel and then print it to pdf.
<UserControl x:Class="WpfApplication5.View.TransferTemplate" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:p="clr-namespace:WpfApplication5.Properties" xmlns:viewmodels="clr-namespace:WpfApplication5.ViewModels" d:DataContext="{d:DesignInstance Type=viewmodels:WarehouseActionViewModel}" mc:Ignorable="d"
x:Name="templ">
<FlowDocument FontFamily="Cambria" FontSize="14" Background="White" x:Name="doc" d:ColumnWidth="1024">
<Paragraph>
<Run>Date: </Run>
<Run Text="{Binding Action.ActionDate, StringFormat=dd-MM-yyyy}" />
</Paragraph>
<Paragraph>
<Run>Note: </Run>
<Run Text="{Binding Action.Note}" />
</Paragraph>
<Paragraph>
<Run>Sender: </Run>
<Run Text="{Binding Action.WarehouseFrom}" />
</Paragraph>
<Paragraph>
<Run>Receiver: </Run>
<Run Text="{Binding Action.WarehouseTo}" />
</Paragraph>
<Table x:Name="border" CellSpacing="0" BorderThickness="0" Background="{StaticResource WhiteBg}" BorderBrush="{StaticResource WhiteBg}">
<Table.Columns>
<TableColumn Width="0.2*" />
<TableColumn Width="0.7*" />
<TableColumn Width="0.1*" />
</Table.Columns>
<TableRowGroup>
<TableRow FontSize="16">
<TableCell BorderThickness="0,1,0,1" BorderBrush="#CCCCCC" Padding="5">
<Paragraph>
<Run Text="{x:Static p:Resources.barcode}" d:Text="Code" />
</Paragraph>
</TableCell>
<TableCell BorderThickness="0,1,0,1" BorderBrush="#CCCCCC" Padding="5">
<Paragraph>
<Run Text="{x:Static p:Resources.Name}" d:Text="Name" />
</Paragraph>
</TableCell>
<TableCell BorderThickness="0,1,0,1" BorderBrush="#CCCCCC" Padding="5">
<Paragraph>
<Run Text="{x:Static p:Resources.quantity}" d:Text="Quantity" />
</Paragraph>
</TableCell>
</TableRow>
<TableRow/>
</TableRowGroup>
</Table>
</FlowDocument>
</UserControl>
PrintDialog printDlg = new PrintDialog();
FlowDocument f = new TransferTemplate(vm).doc;
f.ColumnWidth = printDlg.PrintableAreaWidth;
IDocumentPaginatorSource dps = f;
if ((bool)printDlg.ShowDialog())
{
printDlg.PrintDocument(dps.DocumentPaginator, "flow doc");
}
The problem is when I create it from template and print it adds black border to table
(border thickness is set to 0)
[![enter image description here][1]][1]
but when I create document without xaml template with same code in c# it does not add border
(border thickness not set)
var table1 = new Table
{
CellSpacing = 0,
Background = Brushes.White
};
flowDoc.Blocks.Add(table1);
enter code here
[![enter image description here][2]][2]
How can I fix XAML template to disable border?
[1]: https://i.stack.imgur.com/BlYhX.png
[2]: https://i.stack.imgur.com/HoZnF.png
Just removed x:Name from the table and it worked!
Tip: Adding the Name property to any of the Flowdocument block elements adds a black border when printing (I only tested printing to PDF).
I am no graphic designer but I want a nice looking application. I searched the Internet for WPF Themes and I found i.e. these:
https://visualstudiogallery.msdn.microsoft.com/30e8b37d-01a0-4749-abcb-a5d7631e7646
The themes work fine with Buttons and Textboxes and many controls but not with ListView.
This is how my sample ListView looks without Theme:
And this is how it looks with Theme ShinyBlue (other Themes look similar):
It does not matter which Theme I use (I downloaded many). There is always the problem that the ListView with Theme does not show the items. It just shows some thick lines instead of the items.
Here is the code:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" x:Class="SahaWpfTheme20131.TestWindow1"
Title="Test Window" Width="250" Height="200"
>
<Grid>
<ListView x:Name="ListView1" HorizontalAlignment="Left"
VerticalAlignment="Top" Width="200" Height="150">
<ListViewItem Content="Coffee"/>
<ListViewItem Content="Tea"/>
<ListViewItem Content="Orange Juice"/>
<ListViewItem Content="Milk"/>
<ListViewItem Content="Iced Tea"/>
<ListViewItem Content="Mango Shake"/>
</ListView>
</Grid>
</Window>
Am I doing something wrong or do many Themes just not work with ListView? I am confused why this does not work.
I used a ListView sample from here: http://www.c-sharpcorner.com/uploadfile/mahesh/listview-in-wpf/
When I create a ListView with columns and an ItemsSource, it works (but the colors are messed up, probably a different issue):
<ListView x:Name="ListView1" HorizontalAlignment="Left"
VerticalAlignment="Top" Width="200" Height="150">
<ListView.View>
<GridView>
<GridView.Columns>
<GridViewColumn DisplayMemberBinding="{Binding A}" />
<GridViewColumn DisplayMemberBinding="{Binding B}" />
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>
And in code-behind (of course this is not the proper way to do this, but it is the shortest):
ListView1.ItemsSource = new[]
{
new { A = "qqq", B = "rrr" },
new { A = "qqqq", B = "rrr" }
};
I also got your code to work, but for this I changed the ListViewItem template in BureauBlack.xaml (the theme that is in use):
<GridViewRowPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="0,2,0,2" VerticalAlignment="Stretch" />
to
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Margin="0,2,0,2" VerticalAlignment="Stretch" />
And now the content in the list from your code is shown. But for what you're trying to do, like suggested in a comment, you probably want a ListBox, not ListView.
I have this XAML fragment:
<!-- ... -->
<TabControl>
<TabItem>
<!-- ... -->
</TabItem>
<TabItem Header="Source" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.CanContentScroll="True">
<FlowDocumentScrollViewer>
<FlowDocument>
<Paragraph>
<TextBlock
Text="{Binding Path=CurrentObject.Source}"
FontFamily="Consolas,Courier,Segoe UI"
FontSize="12"
/>
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
</TabItem>
</TabControl>
<!-- ... -->
The problem is that the flow document does not scroll horizontally. I've been unable to enable that.
Any clues?
Thanks in advance.
There are a couple things here. The first being that using a control in the Paragraph functions differently than a Run that would wrap to fit your FlowDocument.
The second is that the FlowDocument will fit your FlowDocumentScrollViewer. If you add a control to it like you did, it will fit the width of the FlowDocument and viewer and the text will go beyond the TextBlock borders. This means that your document doesn't need a scroll bar; your TextBlock would. You can see this by setting the TextWrapping property of the TextBlock to Wrap.
To get around this, set the PageWidth to something beyond the limits of the viewer width like so:
<FlowDocumentScrollViewer>
<FlowDocument PageHeight="1056"
PageWidth="816">
<Paragraph>
<TextBlock
Text="{Binding Path=CurrentObject.Source}"
FontFamily="Consolas,Courier,Segoe UI"
FontSize="12"
/>
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
or bind to your TextBlock:
<FlowDocumentScrollViewer>
<FlowDocument PageHeight="1056"
PageWidth="{Binding ElementName=Part, Path=ActualWidth}">
<Paragraph>
<TextBlock
Text="{Binding Path=CurrentObject.Source}"
FontFamily="Consolas,Courier,Segoe UI"
FontSize="12"
/>
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
The last thing is that the FlowDocumentScrollViewer has it's own HorizontalScrollBarVisibility property that you can use for this (unless some styling issue prevents it).
I am having an issue binding an observable collection of viewmodels to a ListView.
Theres something interesting however which allows me to bind successfully which shows the code is correct ( as far as I can see )
The scenario:
I have 1 main screen which uses 'MainViewModel'
This mainviewmodel has a ListView which binds to a 'OpenSaleViewModel' which in turn has an observable collection of 'OpenSaleItemViewModel' objects.
The code I have in XAML works fine : The DisplayMemberBinding works fine
<Grid x:Name="SalesScreenHolder" Background="AliceBlue" VerticalAlignment="Stretch" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="70" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid x:Name="grdSalesWindow" Margin="0,0,0,0" Grid.Row="0" Width="300" Height="350" MaxHeight="1000" DataContext="{Binding Main, Source={StaticResource MainVM}}">
<ScrollViewer x:Name="salesScrollViewer" PanningMode="VerticalOnly" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Hidden" >
<ListView x:Name="lstviewSales" ItemContainerStyle="{StaticResource alternatingListViewItemStyle}" AlternationCount="2" HorizontalAlignment="Left" HorizontalContentAlignment="Left" ItemsSource="{Binding OpenSale.OpenSalesItems, UpdateSourceTrigger=PropertyChanged}">
<!--<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Height" Value="30" />
</Style>
</ListView.ItemContainerStyle>-->
<ListView.View>
<GridView x:Name="listViewGrid">
<GridViewColumn Width="150" Header="Item"
DisplayMemberBinding="{Binding SaleItemName}" />
<GridViewColumn Width="50" Header="Qty"
DisplayMemberBinding="{Binding Quantity}" />
<GridViewColumn Width="90" Header="TotalPrice"
DisplayMemberBinding="{Binding TotalAmtString}" />
</GridView>
</ListView.View>
</ListView>
</ScrollViewer>
Now say I have 4 OpenSaleViewModel objects, 1 for each sale and each has its own collection of SalesItems
I try and bind the collection to a dialog window i open elsewhere in the application and it only shows me the namespace and the name of the viewmodel : see screenshot
I have tried using path=PROPERTYNAME and Data.PROPERTYNAME
The datacontext IS set as I am accessing properties in the parent viewmodel and binding successfully as you can see in the 3 labels above the grid. I have debugged and can see that the correct amount of items are picked up for each sale but the data is not recnoginized.
The thing is if i set 'ItemsSource="{Binding OpenSale.OpenSalesItems' to be 'ItemsSource="{Binding OpenSale' just to test what happens in the MAIN Screen, this means there is no data to bind against, so it seems that when the observable collection is null in the Main Screen, my dialog window does display the data ok - so i cant understand why 2 different viewmodels with different collections ( using the same class as the basis of the collection though ) seems to be conflicting??
It seems I can only bind when only 1 window is using a collection of the same type of viewmodel ( in this case 'SaleItems' within the sale viewmodel )
This is the code for my dialog window
<Grid x:Name="grdTableSalesItemsxxc" Margin="2,0,2,0" Grid.Row="0" Width="610" Height="200" MaxHeight="1000" >
<ScrollViewer x:Name="tableSalesScrollViewer" PanningMode="VerticalOnly" VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Hidden" >
<ListView x:Name="lstviewTableSalexxc" ItemContainerStyle="{StaticResource alternatingListViewItemStyle}" AlternationCount="2"
HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" ItemsSource="{Binding Sale.OpenSalesItems, BindsDirectlyToSource=True, UpdateSourceTrigger=PropertyChanged}" >
<!--<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Height" Value="30" />
</Style>
</ListView.ItemContainerStyle>-->
<ListView.View>
<GridView x:Name="grdTableSaleGridxxc">
<GridViewColumn Width="295" Header="Item Name"
DisplayMemberBinding="{Binding SaleItemName}" />
<!--<GridViewColumn Width="100" Header="Quantity"
DisplayMemberBinding="{Binding SaleItemName}" />
<GridViewColumn Width="105" Header="Total Price"
DisplayMemberBinding="{Binding SaleItemName}" />-->
</GridView>
</ListView.View>
</ListView>
</ScrollViewer>
This is the collection from the parent viewmodel 'OpenSaleViewModel' which binds first time in the main screen
public ObservableCollection<OpenSaleItemViewModel> OpenSalesItems
{
get
{
if (_salesItems == null)
{
_salesItems = new ObservableCollection<OpenSaleItemViewModel>();
foreach (OpenSaleItem itm in _openSale.OpenSaleItems)
{
// Check if we need to grab the stockPLU or RecipeProduct PLU
if (itm.StockPLU != null)
{
_osi = new OpenSaleItemViewModel(itm.StockPLU);
}
else
{
_osi = new OpenSaleItemViewModel(itm.RecipeProductID);
}
// Populate remaining properties
_osi.Quantity = itm.Quantity;
_osi.TotalAmount = itm.TotalAmount;
_osi.SalesUnitCostPrice = itm.SalesUnitCostPrice;
if (itm.OpenSale != null)
_osi.OpenSaleID = itm.OpenSale.ID;
_salesItems.Add(_osi);
}
}
return _salesItems;
}
set
{
_salesItems = value;
RaisePropertyChanged("OpenSalesItems");
RaisePropertyChanged("TotalVAT");
RaisePropertyChanged("TotalAmtIncVAT");
}
}
I feel like your ItemsSource should be set on your GridView an not on your ListView. Did that not work for you?