|
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...
|
|
|
|
|
This is down to how you define a style - if you define the target type instead of the key, it will get applied. For instance:
<Style TargetType="ScrollBar">
<Setter Property="MinWidth" Value="17"/>
</Style> The key thing here is that no key has been added to the definition of the style.
"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
|
|
|
|
|
Thank you that worked perfectly :P
|
|
|
|
|
how to close a wpf application.
|
|
|
|
|
Use Application.Current.Shutdown();
"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
|
|
|
|
|
The big red switch on the back of the computer.
"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 there, I've been reading the dynamic loading of remote modules. Everything seems pretty straight forward, however, there doesn't seem to be any documentation I've noticed that explains where these "remote" modules can exist.
Are they remote as in the "same" project back on the server or ANY server?
Do the XAP files need to be placed in a specific location, can someone please clear this one up for me?
modified 7-Dec-20 21:01pm.
|
|
|
|
|
Yes. You need to place them in web site.
For example: You have the following Silverlight.
1. Project.Shell
2. Project.Module1
3. Project.Module2
and you have ASP.NET project called Project.Shell.Host.
You need to put Project.Shell.xap, Project.Module1.xap and Project.Module2.xap in Project.Shell.Host that you want to show your Silverlight project.
Hope it helps.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
Hi experts
I'm totally a newbie to WPF. I need to know if we can draw RichTextBox control with mouse. I'm familiar with mouse events like OnMouseDown, OnMouseLeave, etc, but I don't know how to Draw RichTextBox and similar controls with mouse.
Any help/guidance would be really appreciated.
Thanks and best regards
|
|
|
|
|
The big trick is to capture the mouse after the down click, so you get all the messages. Then you use the events to track a box and position a control in that box.
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 Christian,
Thanks a lot for the reply.
This is exactly what I was thinking as an alternative way. But my main point was, "Can we draw RichTextBox,just like a rectangle?"
As an alternative way, we can track down the Mouse Events,draw a simple rectangle for Users to see something being drawn and then get the Canvas/Screen coordinates and replace rectangle with RT Box.
|
|
|
|
|
You don't *draw* a rich text box, you just add one to the parent control, and size it in response to mouse messages. It draws itself.
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'm writing some code that builds a custom file that combines several additional bits of non-image info along with the image file itself. I can create the file just fine, but when I try to load the file and extract the image from it, I get the following exception from PresentationCore :
The image data generated an overflow during processing.
The inner exception is:
Overflow or underflow in the arithmetic operation.
I load the image as a file stream and saving the resulting array of bytes via serialization. I deserialize to load the file and call this method to retrieve the image (the exception is thrown when it calls Bitmapimage.EndInit() ):
public static BitmapImage BitmapImageFromBytes(byte[] bytes, int desiredX, int desiredY)
{
BitmapImage image = null;
MemoryStream stream = null;
try
{
stream = new MemoryStream(bytes);
stream.Seek(0, SeekOrigin.Begin);
image = new BitmapImage();
image.BeginInit();
image.StreamSource = stream;
image.DecodePixelWidth = desiredX;
image.DecodePixelHeight = desiredY;
image.EndInit();
}
catch (Exception ex)
{
if (ex != null) {}
throw;
}
finally
{
stream.Close();
stream.Dispose();
}
return image;
}
"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
|
|
|
|
|
I rather suspect the problem is to do with the Decodes - try not setting them.
"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
|
|
|
|
|
Well, removing those lines removed the exception, but the image doesn't display. :/
I set Image.Source to the retrieved BitmapImage , but I get nada on the screen. I verified that the BitmapImage object contains sane data (the DPI and resolution of the image are correct). What am I missing?
"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
|
|
|
|
|
This is absolute hell, in fact, I blogged about it. If your image control is inside a grid or not, can make a difference. Check my blog ( link below ) for more details, they escape me right now, but basically, I once spent a few hours trying to work out why my image was not shown, and the reason was the control kept a size of 0, which changed when I changed the parent control.
And I spent several hours today trying to make a BitmapImage load a bitmap to be the size it was on disc, all to no avail. I do know that if the DesiredXXX properties work at all, you should set one and it will use that one, and maintain the aspect ratio. You could try that.
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.
|
|
|
|