WPF Datagrid does not show entries - c#

Im new to WPF and C# so please dont rip my head of if i should have done something stupid^^
Im trying to show some data from a SQLite Database file by using a DataGrid. I already installed the relevant package from the SQLite page that includes the VisualStudios designer components. I added the Databasefile as a datasource in Visual Studios which worked pretty good. If i open the Database with the datapreview function it shows my Data the way it should.
My Problem is that even tho i boundet the Datasource as shown on the MSDN page it still isnt showing any Entries, but it sucessfully created all Colums.
Heres my XAML Code:
<Page.Resources>
<local:WorkDataSet x:Key="WorkDataSet"/>
<CollectionViewSource x:Key="personalViewSource" Source="{Binding Personal, Source={StaticResource WorkDataSet}}"/>
<Grid DataContext="{StaticResource personalViewSource}">
<Label Content="Personal" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="20" FontSize="20" FontWeight="Bold"/>
<DataGrid x:Name="personalDataGrid" AutoGenerateColumns="False" EnableRowVirtualization="True" ItemsSource="{Binding}" Margin="10,100,10,10" RowDetailsVisibilityMode="Visible">
<DataGrid.Columns>
<DataGridTextColumn x:Name="iDColumn" Binding="{Binding ID}" Header="ID" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="stationColumn" Binding="{Binding Station}" Header="Station" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="nameColumn" Binding="{Binding Name}" Header="Name" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="_ACD_IDColumn" Binding="{Binding ACD-ID}" Header="ACD-ID" Width="SizeToHeader"/>
<DataGridTemplateColumn x:Name="bild1Column" Header="Bild 1" Width="SizeToHeader">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Bild1}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn x:Name="bild2Column" Header="Bild 2" Width="SizeToHeader">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding Bild2}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn x:Name="visitColumn" Header="Visit" Width="SizeToHeader">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DatePicker SelectedDate="{Binding Visit, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
as far as is understood this it should not require any further C# code cause everything should be set automaticly by Visual Studios.
I know there are a view Questions like this arround here but non of these use SQLite in the way i do...

Related

Maintain column widths of a DataGrid when a grouping option changes

I've been using Rubberduck for a while now to improve my VBA code. The ducky introduced me to unit tests and lots of other proper techniques. In gratitude I'm trying to give back and contribute a fix to an issue I found, in spite of not knowing C#.
The issue deals with a System.Windows.Controls.Grid. The grid has an option of grouping tests results by their outcome or by the module they reside in. If a column width is adjusted and then the grouping is changed the width change isn't reflected.
I've created properties on the viewmodel that I thought would allow two way binding, one shown below as an example.
private DataGridLength _outcomeColumnWidth;
public DataGridLength OutcomeColumnWidth
{
get => _outcomeColumnWidth;
set
{
_outcomeColumnWidth = value;
OnPropertyChanged();
}
}
I've edited the XAML trying to create a TwoWay binding that will have the changed column width persist after the grouping is changed.
<Grid>
<controls:GroupingGrid ItemsSource="{Binding Source={StaticResource ResultsByOutcome}}"
SelectedItem="{Binding SelectedTest}"
ShowGroupingItemCount="True"
Visibility="{Binding IsChecked, ElementName=GroupByOutcome, Converter={StaticResource BoolToVisibility}}">
<DataGrid.Columns>
<DataGridTemplateColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_Outcome}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="unitTesting:TestMethod">
<Image Source="{Binding Result.Outcome, Converter={StaticResource OutcomeIconConverter}}" Height="16" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_QualifiedModuleName}" Binding="{Binding Declaration.QualifiedName.QualifiedModuleName}"
Width="{Binding OutcomeColumnWidth, Mode=TwoWay}"/>
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_MethodName}" Binding="{Binding Declaration.IdentifierName}"
Width="{Binding ModuleColumnWidth, Mode=TwoWay}"/>
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_Message}" Binding="{Binding Result.Output}"
Width="{Binding MessageColumnWidth, Mode=TwoWay}"/>
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_Duration}" Binding="{Binding Result.Duration, StringFormat={}{0}ms}"
Width="{Binding DurationColumnWidth, Mode=TwoWay}"/>
</DataGrid.Columns>
</controls:GroupingGrid>
<controls:GroupingGrid ItemsSource="{Binding Source={StaticResource ResultsByModule}}"
SelectedItem="{Binding SelectedTest}"
ShowGroupingItemCount="True"
Visibility="{Binding IsChecked, ElementName=GroupByLocation, Converter={StaticResource BoolToVisibility}}">
<DataGrid.Columns>
<DataGridTemplateColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_Outcome}">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="unitTesting:TestMethod">
<Image Source="{Binding Result.Outcome, Converter={StaticResource OutcomeIconConverter}}" Height="16" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_QualifiedModuleName}" Binding="{Binding Declaration.QualifiedName.QualifiedModuleName}"
Width="{Binding OutcomeColumnWidth, Mode=TwoWay}"/>
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_MethodName}" Binding="{Binding Declaration.QualifiedName.MemberName}"
Width="{Binding ModuleColumnWidth, Mode=TwoWay}"/>
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_Message}" Binding="{Binding Result.Output}"
Width="{Binding MessageColumnWidth, Mode=TwoWay}"/>
<DataGridTextColumn Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=TestExplorer_Duration}" Binding="{Binding Result.Duration, StringFormat={}{0}ms}"
Width="{Binding DurationColumnWidth, Mode=TwoWay}"/>
</DataGrid.Columns>
</controls:GroupingGrid>
</Grid>
The view model inherits from an abstract class ViewModelBase which implements INotifyPropertyChanged. The abstract class also has public event PropertyChangedEventHandler PropertyChanged and the method OnPropertyChanged. I've set breakpoints on both get and set for the property and neither are ever reached.
DataGrid Columns are not part of the logical or visual tree as they are abstract objects so they don't have access to the DataContext of your ViewModel. Which makes them rather difficult to bind to. Good news is that there are few ways you can do this.
Proxy Object
<UserControl.Resources>
<FrameworkElement x:Key="ProxyElement" DataContext="{Binding}" />
</UserControl.Resources>
<Grid>
<DataGrid ItemsSource="{Binding Descriptions}">
<DataGrid.Columns>
<DataGridTextColumn Header="Description"
Width="{Binding Source={StaticResource ProxyElement}, Path=Width, Mode=TwoWay}"
Binding="{Binding Description}" />
</DataGrid.Columns>
</DataGrid>
</Grid>
For further reading I recommend having a look at https://www.thomaslevesque.com/2011/03/21/wpf-how-to-bind-to-data-when-the-datacontext-is-not-inherited/ as it gives a good overview as to why and gives an alternative to the code above using a specific ProxyClass he creates.

Binding Foreign Key Properties to DataGrid ViewSource

I have this model:
Model
I have a datagrid that shows the component information via a collectionViewSource, and i want a ComboBoxColumn to display the component's programmer.name, as well as show all the other programmers when expanding the combobox so the user can change who is to program that component. Here is my code:
public partial class MainWindow : Window
{
trackerDBEntities context = new trackerDBEntities();
CollectionViewSource componentViewSource;
public MainWindow()
{
InitializeComponent();
componentViewSource = ((CollectionViewSource)(FindResource("componentViewSource")));
DataContext = this;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
System.Windows.Data.CollectionViewSource componentViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("componentViewSource")));
// Load data by setting the CollectionViewSource.Source property:
context.Components.Load();
componentViewSource.Source = context.Components.Local;
}
}
XAML:
<Window x:Class="ToolbarDBIntegration.MainWindow"
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"
xmlns:local="clr-namespace:ToolbarDBIntegration"
mc:Ignorable="d"
Title="MainWindow" Loaded="Window_Loaded">
<Window.Resources>
<CollectionViewSource x:Key="componentViewSource" d:DesignSource="{d:DesignInstance {x:Type local:Component}, CreateList=True}"/>
</Window.Resources>
<Grid DataContext="{StaticResource componentViewSource}">
<DataGrid x:Name="componentDataGrid" AutoGenerateColumns="False" EnableRowVirtualization="True" ItemsSource="{Binding}" RowDetailsVisibilityMode="VisibleWhenSelected">
<DataGrid.Columns>
<DataGridTextColumn x:Name="compFilePathColumn" Binding="{Binding CompFilePath}" Header="Comp File Path" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="compNameColumn" Binding="{Binding CompName}" Header="Comp Name" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="departmentIdColumn" Binding="{Binding DepartmentId}" Header="Department Id" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="designerColumn" Binding="{Binding Designer}" Header="Designer" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="idColumn" Binding="{Binding Id}" Header="Id" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="jobIdColumn" Binding="{Binding JobId}" Header="Job Id" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="materialColumn" Binding="{Binding Material}" Header="Material" Width="SizeToHeader"/>
<DataGridTemplateColumn x:Name="postedDateColumn" Header="Posted Date" Width="SizeToHeader">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DatePicker SelectedDate="{Binding PostedDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn x:Name="programmerColumn" Header="Programmer" Width="SizeToHeader">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox>
<ComboBoxItem Content="{Binding Programmer.Name}" IsSelected="True"/>
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn x:Name="programmer_IdColumn" Binding="{Binding Programmer_Id}" Header="Programmer Id" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="qtyMirColumn" Binding="{Binding QtyMir}" Header="Qty Mir" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="qtyShnColumn" Binding="{Binding QtyShn}" Header="Qty Shn" Width="SizeToHeader"/>
<DataGridCheckBoxColumn x:Name="statusColumn" Binding="{Binding Status}" Header="Status" Width="SizeToHeader"/>
<DataGridTemplateColumn x:Name="timeOnlineColumn" Header="Time Online" Width="SizeToHeader">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DatePicker SelectedDate="{Binding TimeOnline, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn x:Name="xSizeColumn" Binding="{Binding XSize}" Header="XSize" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="ySizeColumn" Binding="{Binding YSize}" Header="YSize" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="zSizeColumn" Binding="{Binding ZSize}" Header="ZSize" Width="SizeToHeader"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
This shows the correct programmer(name) selected for each component, but there i can't figure out how to show the other programmers when expanding the combobox. I have tried binding an itemsource like this:
<DataGridTemplateColumn x:Name="programmerColumn" Header="Programmer" Width="SizeToHeader">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Path=Programmers, Mode=TwoWay}" DisplayMemberPath="Name">
<ComboBoxItem Content="{Binding Programmer.Name}" IsSelected="True"/>
</ComboBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
But that doesn't work. Do i have a problem with the way my model is configured? It seems i can't access Programmers as a collection, it only recognizes the one programmer per component.
I have looked at 20+ similar posts but i can't figure out what i am missing, any direction would be wonderful.
First, you're going to need to create a separate collection view source for your Programmers collection. Then populate it just like you do for Components.
<CollectionViewSource x:Key="programmerViewSource"
d:DesignSource="{d:DesignInstance {x:Type l:Programmer}"/>
var componentViewSource = (CollectionViewSource)FindResource("componentViewSource");
var programmerViewSource = (CollectionViewSource)FindResource("programmerViewSource");
context.Components.Load();
context.Programmers.Load();
componentViewSource.Source = context.Components.Local;
programmerViewSource.Source = context.Programmers.Local;
Now, replace your column definition like so:
<DataGridComboBoxColumn Header="Programmer"
DisplayMemberPath="Name"
ItemsSource="{Binding Source={StaticResource programmerViewSource}}"
SelectedItemBinding="{Binding Programmer}" />

WPF bound data not loading to bound controls

EDIT
I've deviated from the methods illustrated here (which I was unable to get to work).
Binding data worked when I implemented MVVM as per this question
ORIGINAL QUESTION
I followed a tutorial (which I've since lost the link to) to create a data binding for my DataGrid.
The process involved creating a data source from my model which allowed me to drag a DataGrid onto my Window.
The DataGrid renders empty on the window when I run it and I know for a fact there is data that needs to go into it.
Here's the code:
<Page.Resources>
<CollectionViewSource x:Key="campaignViewSource" d:DesignSource="{d:DesignInstance {x:Type Models:Campaign}, CreateList=True}"/>
</Page.Resources>
<DataGrid x:Name="campaignDataGrid" AutoGenerateColumns="False" EnableRowVirtualization="True" ItemsSource="{Binding}" Grid.Row="1" RowDetailsVisibilityMode="VisibleWhenSelected">
<DataGrid.Columns>
<DataGridTextColumn x:Name="clientColumn" Binding="{Binding Client}" Header="Client" Width="SizeToHeader"/>
<DataGridTemplateColumn x:Name="dateSentColumn" Header="Date Sent" Width="SizeToHeader">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DatePicker SelectedDate="{Binding DateSent, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn x:Name="idColumn" Binding="{Binding Id}" Header="#" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="nameColumn" Binding="{Binding Name}" Header="Name" Width="SizeToHeader"/>
<DataGridTextColumn x:Name="emailAddressColumn" Binding="{Binding EmailAddress}" Header="Email Address" Width="SizeToHeader"/>
</DataGrid.Columns>
</DataGrid>
According to the tutorial I built this from, there's nothing more that I need to do to make this work. So what have I missed?
How should I proceed?
Try to bind the ItemsSource property to your CollectionViewSource:
<DataGrid x:Name="campaignDataGrid" AutoGenerateColumns="False" EnableRowVirtualization="True"
ItemsSource="{Binding Source={StaticResource campaignViewSource}}" Grid.Row="1" RowDetailsVisibilityMode="VisibleWhenSelected">
You also need to set the Source property of the CollectionViewSource to some source collection:
var cvs = this.Resources["campaignViewSource"] as CollectionViewSource;
cvs.Source = new List<YourDataObject> { new YourDataObject(), new YourDataObject() };
The drag-and-drop approach is really no good way of either doing or learning something. You should learn XAML and MVVM if you want to become a successful WPF developer.

How to get row values with DataGridTemplateColumn connected to different ItemSource

I’m using WPF MVVM DataGrid and one of the columns is the equivalent of DataGridComboBoxColumn, but made of DataGridTemplateColumn .
DataGrid itself is binded to one object, and ComboBox column is binded to the separate one.
The XAML code is:
<DataGrid Grid.Column="0" AutoGenerateColumns="False" CanUserAddRows="False" ItemsSource="{Binding ItemNamesSetting}">
<DataGrid.Columns>
<DataGridTextColumn Header="Item1" Binding="{Binding Path=OriginalItemName}" />
<DataGridTextColumn Header="Item2" Binding="{Binding Path=FinalItemName}" />
<DataGridTemplateColumn Header="Attribute">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding DataContext.AttributesBindingList, ElementName=ThirdStepTab}" DisplayMemberPath="PropName" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Item3" Binding="{Binding Path=Separatopr}" />
</DataGrid.Columns>
</DataGrid>
The question is how can I get the full row data? I’m planning to have one “Save” button that would send data to the database and I need to get data in text columns + data at ComboBox from different ource – row by row. Is there a way to do it?
Thank you.
You need to bind the SelectedItem property of DataGrid to your MVVM view Model. Also, the one of relevant property of view model should bind to Combobox SelectedValue
<DataGrid Grid.Column="0" AutoGenerateColumns="False" CanUserAddRows="False" ItemsSource="{Binding ItemNamesSetting}" SelectedItem="{Binding VMPropertyName}" >
<DataGrid.Columns >
<DataGridTextColumn Header="Item1" Binding="{Binding Path=OriginalItemName}" />
<DataGridTextColumn Header="Item2" Binding="{Binding Path=FinalItemName}" />
<DataGridTemplateColumn Header="Attribute">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding DataContext.AttributesBindingList, ElementName=ThirdStepTab}" DisplayMemberPath="PropName" SelectedValue="{Binding PropertyOfVM}" />
</DataTemplate> </DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Item3" Binding="{Binding Path=Separatopr}" />

binding to static property problem

I'm using the EntityFramework and working on an invoicing application. Below is the xaml code from myDataGrid. Now it compiles and everything works great, but the problem is, the static binding I have on the DataGridComboBoxColumn throws an exception when in designer mode because that static property actually loads from a MySql database using the entity framework.
<DataGrid x:Name="ItemsGrid" Grid.Row="2" Grid.ColumnSpan="3" ItemsSource="{Binding Items}" FontSize="11" AutoGenerateColumns="False" CanUserAddRows="False" RowHeaderWidth="0" GridLinesVisibility="None" CanUserResizeRows="False" CanUserResizeColumns="False" CanUserReorderColumns="False">
<DataGrid.Columns>
<DataGridTemplateColumn Width="150" Header="Item No.">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBox Width="130" BorderThickness="0" Background="Transparent" Text="{Binding Number}" />
<Image MouseDown="ItemSelectionButton_Click" Margin="0,0,0,0" Width="12" Source="/Images/Icons/SearchBlack.png" />
</StackPanel>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Width="70" Header="Quantity" Binding="{Binding Quantity}" />
<DataGridTextColumn Width="70" Header="Order" Binding="{Binding Order}" />
<DataGridTextColumn Width="70" Header="B/O" Binding="{Binding BackOrder}" />
<DataGridTextColumn Width="60" Header="Units" Binding="{Binding Units}" />
<DataGridTextColumn Width="200" Header="Description" Binding="{Binding Description}" />
<DataGridTextColumn Width="90" Header="Price" Binding="{Binding Price}" />
<DataGridComboBoxColumn Width="50" Header="Tax" ItemsSource="{x:Static app:Session.TaxCodes}" SelectedValueBinding="{Binding TaxCodeID}" DisplayMemberPath="Code" SelectedValuePath="ID" />
<DataGridTextColumn Width="90" Header="Amount" Binding="{Binding Amount}" />
<DataGridTextColumn Width="90" Header="Linked" Binding="{Binding SalesOrderID}" />
</DataGrid.Columns>
</DataGrid>
Here's the exception:
The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
at DtcInvoicer.Models.DatabaseEntities..ctor() in F:\Development\DTC Industrial\DtcInvoicer\DtcInvoicer\Models\DatabaseModel.Designer.cs:line 42
at DtcInvoicer.Models.Repository.get_GetContext() in F:\Development\DTC Industrial\DtcInvoicer\DtcInvoicer\Models\Repository.cs:line 14
at DtcInvoicer.Models.TaxCodesRepository.SelectAll() in F:\Development\DTC Industrial\DtcInvoicer\DtcInvoicer\Models\TaxCodesRepository.cs:line 54
at DtcInvoicer.Session..cctor() in F:\Development\DTC Industrial\DtcInvoicer\DtcInvoicer\Session.cs:line 18
I know trying to fix the root of the problem will be too much work, I'm wondering if there's a simple workaround like dynamically binding to a static property in another class. Anyone have any idea how to do this? Looking for a xaml only solution.
Here's what I already tried...
ItemsSource="{Binding Path=TaxCodes, Source={x:Static app:Session}}"
ItemsSource="{Binding Path=TaxCodes, Source={StaticResource app:Session}}"
ItemsSource="{Binding app:Session.TaxCodes}"
Any help is appreciated.
Thanks.
Could you use something like d:ItemsSource="{x:Null}", and define d in your Window or UserControl like mc:Ignorable="d"?
It should make the design-time property of ItemsSource equal to null
Edit
Forgot to add the definition for mc - It is
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

Categories