|
Can you post the XAML that these controls are in? This will help me get context so I can create my own test application.
BTW: When does this above code run?
Can you please post the entire method that these assingments run in.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Actually, I figured out not 10 mins after my last post. It seemed to be something with the animation that plays right before any of the actual code is run. I re-did the animation after screwing it up doing something else, and everything seemed to start moving when it supposed to.
Thanks for your help though, and I apologize if I wasted your time.
|
|
|
|
|
Glad you got it all working!
modified 27-Feb-21 21:01pm.
|
|
|
|
|
XML Data :
<?xml version="1.0" encoding="utf-8" ?>
- <ControlData>
- <Companies>
- <Company ID="100" LocationID="2000">
- <CustomerWindow>
<Email Visibility="Hidden" />
</CustomerWindow>
</Company>
- <Company ID="200" LocationID="2000">
- <CustomerWindow>
<Email Visibility="Hidden" />
</CustomerWindow>
</Company>
- <Company ID="300" LocationID="1000">
- <CustomerWindow>
<Email Visibility="Visible" />
</CustomerWindow>
</Company>
- <Company ID="200" LocationID="1000">
- <CustomerWindow>
<Email Visibility="Visible" />
</CustomerWindow>
</Company>
</Companies>
</ControlData>
public partial class CustomerDetails : Window
{
CollectionViewSource cvs = new CollectionViewSource();
XmlDataProvider dp = new XmlDataProvider();
public CustomerDetails()
{
InitializeComponent();
}
private void Binding()
{
CollectionViewSource vs = this.FindResource("MyCollectionView") as CollectionViewSource;
vs.View.CurrentChanged+=new EventHandler(view_CurrentChanged);
ControlDataViewModel cdvm = new ControlDataViewModel();
XmlDocument dc = new XmlDocument();
dc.LoadXml(cdvm.XmlData);
dp.Document = dc;
dp.XPath = "ControlData/Companies";
cvs.Source = dp;
cvs.Filter += new FilterEventHandler(cvs_Filter);
//Binding Expression
Binding bind = new Binding();
bind.Source = cvs;
bind.XPath = "Company/CustomerWindow/Email/@Visibility";
//Find the Email Control and binds.
ContentPresenter cp = VisualTreeHelper.GetChild(Details, 0) as ContentPresenter;
DataTemplate dat = Details.ContentTemplate;
StackPanel sp = dat.FindName("Test", cp) as StackPanel;
TextBlock tb = sp.FindName("EMail") as TextBlock;
tb.DataContext=cvs.View;
tb.SetBinding(TextBlock.VisibilityProperty, bind);
}
void cvs_Filter(object sender, FilterEventArgs e)
{
CollectionViewSource vs = this.FindResource("MyCollectionView") as CollectionViewSource;
Customer cust = vs.View.CurrentItem as Customer;
XmlElement xdoc = e.Item as XmlElement;
XmlNode node = xdoc.SelectSingleNode("Company[@ID='" + cust.CompanyID + "' and @LocationID='" + cust.LocationID + "']");
if (node != null)
{
e.Accepted = true;
}
else
{
e.Accepted = false;
}
}
void view_CurrentChanged(object sender, EventArgs e)
{
cvs.View.Refresh();
}
private void CustomerWindow_Loaded(object sender, RoutedEventArgs e)
{
Binding();
}
}
XAML :
<Window
x:Class="XamDataGridCurrentItemSync.CustomerDetails"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:igDP="http://infragistics.com/DataPresenter"
xmlns:local="clr-namespace:XamDataGridCurrentItemSync"
Title="Control Data Collection"
Width="400" Height="550"
WindowStartupLocation="CenterScreen" x:Name="CustomerWindow" Loaded="CustomerWindow_Loaded">
<Window.Resources>
<ObjectDataProvider x:Key="MyCustomers" ObjectType="{x:Type local:CustomerViewModel}" />
<CollectionViewSource x:Name="CVS" x:Key="MyCollectionView" Source="{Binding Source={StaticResource MyCustomers},Path=CustomerDataCollection}" />
</Window.Resources>
<Grid>
<StackPanel>
<Border BorderBrush="Black" BorderThickness="2">
<ListView Name="ListViewCustomerDetails" Margin="4,20,40,100" ItemsSource="{Binding Source={StaticResource MyCollectionView}}" IsSynchronizedWithCurrentItem="true">
<ListView.View>
<GridView>
<GridViewColumn Header="First Name" DisplayMemberBinding="{Binding Path=FirstName}"/>
<GridViewColumn Header="Last Name" DisplayMemberBinding="{Binding Path=LastName}"/>
<GridViewColumn Header="EMail" DisplayMemberBinding="{Binding Path=EMail}"/>
</GridView>
</ListView.View>
</ListView>
</Border>
<ContentControl Content="{Binding Source={StaticResource MyCollectionView}}" x:Name="Details">
<ContentControl.ContentTemplate>
<DataTemplate x:Name="Template1">
<StackPanel Margin="20" x:Name="Test">
<TextBlock x:Name="FirstName" Text="{Binding Path=FirstName}" Height="30" />
<TextBlock x:Name="LastName" Text="{Binding Path=LastName}" Height="30" />
<TextBlock x:Name="EMail" Text="{Binding Path=EMail}" Height="50" />
</StackPanel>
</DataTemplate>
</ContentControl.ContentTemplate>
</ContentControl>
</StackPanel>
</Grid>
</Window>
I am binding the Customers to the ListView and contentControl.It works fine.Also i am binding SecurityData which says whether the Email is visible for an customer based on the companyID and LocationId.I have the securitydata in the Xml format.It is binding well for the first record when i navigate between records it is not reapplying the binding based on the filtered data.Please go through the code and give your suggestion why it is not working.
modified on Thursday, October 30, 2008 7:57 PM
|
|
|
|
|
It seems from everything I've been told and seen so far that you can't access a sql server through anything, but WCF. Is that really true?
The application arcitect at work demonstrated a very simple app that used isolated storage and he said he couldn't tell it the location of the actual data storage. When he did it didn't put it in the path he specified.
Your thoughts.
|
|
|
|
|
You can access SQL Server through SOAP 1.1, i.e. a web service (whether it's a WCF Web Service or a good old fashioned WebMethod type).
This[^] should tell you where things are stored with Isolated Storage.
|
|
|
|
|
That's what my point is though. You have to hit a web service and cannot directly access the sql server with ADO.
Thanks for the link.
|
|
|
|
|
wolfbinary wrote: You have to hit a web service and cannot directly access the sql server with ADO.
True - but when you think about it, that's a logical thing to want to do. Typically, your database will be behind a Firewall in a DMZ. This means that you really should have something in the way so that the DB doesn't have to be exposed to the outside world.
|
|
|
|
|
Most of the web apps here aren't exposed to the outside world. They are for internal use only.
I do see your point about the DMZ, though.
|
|
|
|
|
Hello,
I have a silverlight application, and I want to open an aspx page inside the Silverlight and to interact between them.
Does anyone know if it is possible in Silverlight?
tnx
|
|
|
|
|
I have also the same issue with my Silverlight website with released version 2.
I have created a website with have some xaml pages, I want to show contents dynamically it might be aspx page or simple html page, contents of which can be loaded on the xaml page at runtime on a button click.
Thanks in advance
|
|
|
|
|
Hello,
I'm writing a windows application that uses the Amazon FPS web service. I would like to use WCF, though I don't have much experience with it yet. I thought that by adding a web reference to the service WSDL, that a proxy class would be created for me. The web reference was added, and I can browse the types defined in the WSDL in the object browser, but Visual Studio did not generate a proxy class.
What's the best way to proceed? Do I have to use svcutil to generate the proxy code?
Thanks!
Ian
|
|
|
|
|
You need to add a service reference.
Right click the project and [Add Service Reference]
Pop the service url into the address box and hit [Go]
Give it a name and click [OK]
...
|
|
|
|
|
Is this available in VS 2005? I couldn't find an options for adding a service reference. There were two options: Add Reference, and Add Web Reference.
Any ideas?
Thanks!
Ian
|
|
|
|
|
Once I installed the VS 2005 enhancements for .Net 3.0 (WPF,WCF) I had the "Add Service Reference" options.
Thanks for your help, Jammer, as it pointed me in the right direction.
Ian
|
|
|
|
|
No problem fella ... I've only ever worked with .NET 3.5 / VS2008 ... never had the joy of using the VS2005 extensions.
|
|
|
|
|
Hi Everyone,
I am working on a project on VS 2008. It requires to generate reports based on predefined templates.
I will not be using the Crystal reports or the SQL reporting services.
IS there a way I can design a template and create report using WPF and VS2008
Any suggestion will be a great help to my project.
Thanks everyone,
Kasi
|
|
|
|
|
Kasi,
Getting data on a form is super easy in WPF.
However, you may want to direct your energy towards actually printing the report on paper and exporting the report to .PDF or other file format.
This is why, SQL Reporting Services shines. It does all this for you.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
I have a Silverlight application and I want to add some DHTML to it.
Does anybody know if it is possible and how this can be done?
anyone had experience with something like that?
thanks
|
|
|
|
|
Hi
there is the easy way and there is the hard way.
I've seen a n example that shows a div above the silverlight but I diden't like it.
I used Visual webGui platform that allows me to do things in silverlight much faster like using there HTML box to display html inside Silverlight.
you should check it out.. www.visualwebgui.com
good luck
|
|
|
|
|
|
|
Good job Karl. Way to go.
|
|
|
|
|
Pete,
Appreciate the encouragement.
Enjoy and write some code!
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Awesome! Thanks Karl!
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|