|
burger87 wrote: Hey Pete(is that your name?).
Yes.
burger87 wrote: 1) What is an ObservableCollection? Is it similar to a container?
An ObservableCollection is a specialist collection that's designed to support data binding in WPF and Silverlight. Basically, when you add or remove an item from this collection the collection notifies the binding engine that values have been added or removed.
burger87 wrote: For the DataContext, what do you mean by "bind to the collection"? Do you mean the ObservableCollection?
Yes.
burger87 wrote: If I use the database's values to update the chart instead of using ObservableCollection, do I still need to make use of ObservableCollection?
Seriously, use the collection - create a model that encapsulates your database values and put this into your collection. Don't cause problems for yourself; use the tools available.
burger87 wrote: What is MVVM? I'm interested. Does it help my situation in any case?
MVVM is a pattern - it stands for Model-View-ViewModel. Basically this pattern is designed to work with Silverlight and WPF. Google it to find out about it, and read the samples and articles (I have a WPF version here[^]).
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I am trying to make a dissolve in-out effect for my image but I have no idea how to do it.
Does anyone have any ideas?
Thanks a lot.
|
|
|
|
|
Yes - use the Wpffx[^] library on Codeplex.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Use a storyboard.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi,
I am using the Calendar control from the WPF toolkit, to display events based on values in an MS Access Table.
I customised the method decribed in the RedLetterDay example in this article, by placing my Select staement in the IValueConverter.
As a result, the performance is very slow, as it is making a seperate db connection for each day rendered in the calendar.
I takes approx 25 seconds to load, how can I reduce this time?
Thanks,
Glyn
|
|
|
|
|
Do you retrieve the items only once, or every time? To be honest, I wouldn't look at using that as a starting point because it's not a brilliant example.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I am retrieving the items every time (i.e. for every day displayed on the calendar), which is why it's slow.
You say that the example is not a brilliant example, do you have a link to a better article?
How do I retrieve the data onle once? Do you have any examples?
Can the date be collected in the code behind, and bound the the calendar?
|
|
|
|
|
Hi,
In my silverlight application I need to call a WCF service. I have to pass a string variable as input and return an array list from the WCF service.
If anyone have any idea how to call WCF service or pass perameters to the WCF service please reply me.
Thanks in Advance.
|
|
|
|
|
If you are using Visual Studio 2008, you need to install Silverlight Tool for Visual Studio. You will see the Silverlight Project template in "New Project" dialog after installation.
1. Chose Silverlight Application and check the check box for ASP.NET project for hosting Silverlight.
2. Add Silverlight-Enabled WCF service in ASP.NET
3. Write a method with parameter and return the array list that you want.
4. Build the ASP.NET project
5. Add this service as a service reference in Silverlight project.
6. then, you will be able to see the method that you write in Silverlight-Enabled WCF service
Hope it helps.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
|
i have an asp.net website. I am also having a wpf application. I had published the wpf application and has a url which can be directly opened from ie explorer when pasted on its url window. now how can i open this wpf window from website in the same window. i have been trying to do it through response.redirect but could not do it.
|
|
|
|
|
You can't. It's not possible.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
You need to use silverlight.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I created a custom textbox inheriting from wpf textbox and overriding OnRender. I used FormattedText to set background colors of few words in the textbox. Somehow the fonts are becoming bold, not sure why. How to get-rid of that? Here is my code.
<br />
if (this.Text != "")<br />
{<br />
FormattedText formattedText = new FormattedText(<br />
this.Text,<br />
CultureInfo.InvariantCulture,<br />
FlowDirection.LeftToRight,<br />
new Typeface(this.FontFamily,this.FontStyle,this.FontWeight,this.FontStretch),<br />
this.FontSize,<br />
this.Foreground);
<br />
<br />
double leftMargin = 4.0 + this.BorderThickness.Left;<br />
double topMargin = 2 + this.BorderThickness.Top;<br />
formattedText.MaxTextWidth = this.ViewportWidth;
formattedText.MaxTextHeight = Math.Max(this.ActualHeight + this.VerticalOffset, 0);
drawingContext.PushClip(new RectangleGeometry(new Rect(0, 0, this.ActualWidth, this.ActualHeight)));
<br />
<br />
if (HighlightText != null && HighlightText.Length > 0)<br />
{<br />
foreach (string text in HighlightText)<br />
{<br />
int txtEnd = this.Text.Length;<br />
int index = 0;<br />
int lastIndex = this.Text.LastIndexOf(text, StringComparison.OrdinalIgnoreCase);<br />
<br />
while (index <= lastIndex)<br />
{<br />
index = this.Text.IndexOf(text, index, StringComparison.OrdinalIgnoreCase);<br />
<br />
Geometry geom = formattedText.BuildHighlightGeometry(new Point(leftMargin, topMargin - this.VerticalOffset), index, text.Length);<br />
if (geom != null)<br />
{<br />
drawingContext.DrawGeometry(Brushes.Yellow, null, geom);<br />
}<br />
index += 1;<br />
}<br />
<br />
}<br />
}<br />
<br />
drawingContext.DrawText(formattedText, new Point(leftMargin, topMargin - this.VerticalOffset));<br />
<br />
}<br />
Thanks.
modified on Tuesday, July 28, 2009 5:35 PM
|
|
|
|
|
i found the mistake i was doing.
Do not draw the text, which will draw on top the existing text of the textbox making it look bold.
I removed
drawingContext.DrawText(formattedText, new Point(leftMargin, topMargin - this.VerticalOffset));<br /> from the logic and it worked fine.
|
|
|
|
|
Hi,
I've found many people getting the same error I get but no one with the same problem.
I'm using a third-party control DLL (http://www.codeproject.com/KB/WPF/XPlorerBar2.aspx) in my WPF application. It's referenced and when I start the application the control is displayed and works correctly. When I open the VS 2008 WPF designer, I get an error:
Assembly '{0}' was not found. The 'clr-namespace' URI refers to an assembly that is not referenced by the project.
Line of code: <xpbar:xplorerbar name="xPlorerBar" width="194" verticalcontentalignment="Top" horizontalalignment="Left" xmlns:xpbar="clr-namespace:ZonaTools.XPlorerBar;assembly=ZonaTools.XPlorerBar">
Sometimes the designer works, especially when I delete all references and add them after restarting VS. After a while the designer fails again.
This seems to be a bug in the designer (because the application runs without an error) - am I right? Is there a known solution? I'm using VS 2008 Professional SP1.
Thank you for your help!
|
|
|
|
|
The designer is an absolute nightmare. I get the same thing when I use custom controls that exist in the same project.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
Hi anyone
Which is the recommended way to embed an excel workbook inside WPF (WebBrowser Control over WindowsFormsHost, other active document hosts)? Has anyone experiences about that?
I'm using VS 2008 and WPF. My goal is to embed an excel workbook into my application.
Thank you all for any responses
|
|
|
|
|
I expect you'd embed a winforms control, which then took care of excel.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi,
In a WPF Application using XAML,
I created a stackpanel(width 1030) and I have 2 Images. 1. imgClient width = 784 Height = 66 and 2. imgClientExtra width =1 and Height = 66
imgClientExtra will be right end and imgClient will start at leftend.
so, the images will fit to 784 + 1 when the application is not running, the total image width is 785(784+1).. but, wen the application is running.. the image has to stretch to 1030... with imgClientExtra will be at 1030 and imgClient will have to stretch to 1029 only..
I used stretch.fill ... but didnt work.,.
<StackPanel Name="stkpnlHeader" Margin="0,0,0,0" Width="1254.662" Height="auto" HorizontalAlignment="Left" VerticalAlignment="Top">
<StackPanel Name="imgStkPnl"Orientation="Vertical" Width="1253.511" HorizontalAlignment="Left">
<Image Name="imgClientPhoto" HorizontalAlignment="Left" VerticalAlignment="Top" Width="784" Height="66"
Source="D:\ehtmp_top_left.gif" Stretch="Fill" StretchDirection="Both">
</Image>
<Image Name="imgExtraImg" Width="1" Height="66" Margin="0,-66,0,0" HorizontalAlignment="Right"
Source="D:\ehtmp_top_right.gif"
></Image>
</StackPanel> </StackPanel>
Please help.. Thanks Ramm
modified on Tuesday, July 28, 2009 7:32 AM
|
|
|
|
|
I suspect the <Image Stretch> property is ignored, because
HorizontalAlignment="Left" VerticalAlignment="Top" is what influence the size of the Image in the stack panel!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Your XAML doesn't match your description (e.g. images on the left and right ends of a vertical stackpanel??).
Items in Stackpanels are sized by the item, not the stackpanel size,
so you'd need to specify width and/or height of the stackpanel's children
to get the layout you want using a stackpanel. Something like:
<StackPanel Name="stkpnlHeader" Width="1254.662" Height="Auto" >
<StackPanel Name="imgStkPnl" Orientation="Horizontal" Width="1253.511" >
<Image Name="imgClientPhoto" Source="D:\ehtmp_top_left.gif" Stretch="Fill" Width="1030" Height="66" />
<Image Name="imgExtraImg" Source="D:\ehtmp_top_right.gif" Width="1" Height="66" />
</StackPanel>
</StackPanel>
The drawback to this approach is that the dimensions are hardwired to
specific values, making changes problematic. To get around that, you
could use a more appropriate layout element. For example, a grid:
<StackPanel Name="stkpnlHeader" Width="1254.662" Height="auto" >
<Grid Name="imgGrid" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="66" />
</Grid.RowDefinitions>
<Image Name="imgClientPhoto" Grid.Column="0" Source="D:\ehtmp_top_left.gif" Stretch="Fill" />
<Image Name="imgExtraImg" Grid.Column="1" Source="D:\ehtmp_top_right.gif" />
</Grid>
</StackPanel>
Note the difference - grids lay out children, stack panels are laid out by
their children.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark and Lloyd,
Thanks a lot for the suggestions.
It worked ...
I was thinking that stackpanel adjusts the rest of the image stretch.
Mark,
Thanks for the tip.
I am learning
Thank you,
Ramm
|
|
|
|
|
So lets say i have some theme dll called: "ThemeAssortment.dll".
And in a test-program i reference that dll and in my App.xaml" i do:
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ExpressionTheme.App"
StartupUri="MainWindow.xaml">
<Application.Resources>
<!-- Resources scoped at the Application level should be defined here. -->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/ThemeAssortment;Component/ColoredTheme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
So what do i need to do for this alone to auto-apply some styles to all controls in use in the application?
If i do: <ScrollBar Style="{DynamicResource ScrollBar}" /> Then a scrollbar gets the appropriate scrollbar theme... but if i don't specify a Style... then one does not get automatically applied...
|
|
|
|