|
I found this for you:
http://blogs.msdn.com/jgalasyn/archive/2007/10/29/troubleshooting-wpf-designer-load-failures.aspx[^]" which talks about, "If you want your custom control to load in the WPF Designer, you must provide CLR get and set methods for any dependency properties that you have defined. For more information, see Custom Dependency Properties."
but this: http://msdn.microsoft.com/en-us/library/bb546970.aspx[^] seemed to be more like what you are looking for,
"Editors can be either inline editors, which allow you edit values directly in the Properties window, or extended editors, which allow you to provide an additional UI for editing a property outside of the Properties window"
Good luck
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Thanks! it looks a bit complicated, but i'll try to make something out of it.
|
|
|
|
|
AAAh dammn this is so annoying. I just don't get your samples. I try to get them working but it just seems it isn't what i'm looking for. How did microsoft do this when building the Grid.ColumnDefinitions? Why can't i find out how to do this.
Back to the first thing i found, indexers, maybe that is an idea? I can create them and make them visible in the designer, but then i get a strange string value (so now button with three dots to edit a list or something)
I'm so sorry i just don't get it and keep annoying you with my questions..
Thanks, a thousand times,
Vincent
|
|
|
|
|
YAY! I got it to work! well, not completely: i found this (NewItemTypesAttribute)[^] description and tried the sample (copied and pasted the parts I needed). I found out it just don't likes ints! A lot of things you enter int the NewItemTypesAttribute, like TextBlocks which i actually wanted to List (but this didn't work out because of a reason I don't get), but int just doesn't! I tried it after doing this with a List<textblock>, and amazingly, without the NewItemTypesAttribute, it just works!
The problem I first had was that I could add items through the designer (I think I was using Blend then), but if i checked Count or tried to get a value with operator[], it just told me 0 or threw an exception. I checked the Count now, and it works. All very strange..
Here's my code:
private List<TextBlock> _TextBlockList = new List<TextBlock>();
public List<TextBlock> TextBlockList
{
get
{
return _TextBlockList;
}
set
{
_TextBlockList = value;
}
}
Thanks for all your help!
Vincent
|
|
|
|
|
I have a WPF control in a ElementHost. I then display the control on the web page in a object tag
<object id="myObject" classid="http://server/application/ClientBin/MyControl.Chart.DLL#MyControl.Chart.ChartControl" height="600" width="800" />
However, I am getting security exceptions because of the element host. I've signed the DLL and have the certf in IE under trusted root and trusted publisher, and can view the control if I run it normally under a XBAP.
Is there anything else I need to do?, I am a bit lost, I've searched google and not really found much help.
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
I have a Frame control inside a main WPF page. The frame shows other WPF pages. For some reason, the frame clips the content without scrolling. I've tried embedding the frame in other controls, but no luck.
Has anyone dealt with this issue?
Thanks!
Evan
|
|
|
|
|
Evan Stein wrote: I've tried embedding the frame in other controls
Sorry, but what does this mean? You mean like wrapping your pages in a scrollviewer control?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
I mean, nesting the Frame as a child control, like so
<ScrollViewer>
<Frame/>
</ScrollViewer>
As I said, this doesn't seem to help.
|
|
|
|
|
I would think that you would want to do this
<Frame>
<ScrollViewer>
<Page/>
</ScrollViewer>
</>Frame
After all you want the pages to scroll not the frame right?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
I haven't found a solution for this yet, probably a lack of Google skills, but how can I update the contents in a richtextbox in wpf from a different thread?
There is not Invoke or BeginInvoke on the control so delegates won't work?
And using a delegate in this way:
this.Dispatcher.Invoke(DispatcherPriority.Normal, new AddTextDelegate(_AppendtextLine), null, new object[] { text });
only makes the application hang.
Any good ideas on this?
|
|
|
|
|
|
Unfortunately, that won't help.
Since i'm already on another thread when recieving the event, that's nothing I can control.
The problem is access to the controls on the main thread when an event is recieved.
|
|
|
|
|
Is is possible to host .NET 2.0 controls in WPF on .NET 3.0?
Johan Lombaard
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former - Albert Einstein
|
|
|
|
|
Yes. .NET 3/3.5 is a superset of the capabilities of 2, so you can host 2.0 controls in WPF.
|
|
|
|
|
Thanks for the reply.
Do you perhaps know how to do it ?
Johan Lombaard
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former - Albert Einstein
|
|
|
|
|
|
Ok, So I'm trying to programatically set the left margin on three controls, a textblock named "Clock", a StackPanel named "TasksIcos", and a button named "Options". This is the code I'm using:
<br />
TasksIcos.Margin = New Thickness(TasksIcos.Margin.Left + 32, TasksIcos.Margin.Top, TasksIcos.Margin.Right, TasksIcos.Margin.Bottom)<br />
Options.Margin = New Thickness(-MiniModePanel.Width + 43, Options.Margin.Top, Options.Margin.Right, Options.Margin.Bottom)<br />
Clock.Margin = New Thickness(Clock.Margin.Left + 43, 0, -7, 0)
The only one that moves any at all, is "Options". The other two do not move regardless of what the values are entered.
Can a WPF guru tell me what I'm doing wrong here?
|
|
|
|
|
I'm spitballing, but what is the value of TaskIcos.Margin when this code runs? Is it null? If so, that is your problem.
Step through your code and see what is actually getting created.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
TasksIcos.Margin.Left = -192 at runtime and in blend.
|
|
|
|
|
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.
|
|
|
|