|
Sr...Frank wrote: How to bound them with windows form in WPF?
I'm not sure what you're asking here...
If you're using Windows Forms, why use WPF controls?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
Any trick to select multiple items in WPF listbox without holding shift key? Multiple items should be selected on holding and dragging just left mouse button.
Thanks
|
|
|
|
|
I'm learning that WPF is all about laying out your controls in a non-fixed fashion to be able to accomodate dynamic content. All well and good.
The application I need to write, however needs to display objects on a map in their precise locations. Does WPF provide enough support for fixed layout of objects so that I can implement my mapping application?
|
|
|
|
|
You can layout anything in a 'fixed' way by using a combination of the HorizontalAlighment VerticalAlignment and Margin properties, when used inside a Grid or a Canvas panel.
|
|
|
|
|
Hi..
I created a WPF C# application.
I deployed it to an computer with the .Net 3.5 framework.
When I double-click on the EXE nothing happens.. ANd i have got this error:
EventType : clr20r3 P1 : firstc1.exe P2 : 1.0.0.0
P3 : 4b2f37b0 P4 : presentationframework P5 : 3.0.0.0 P6 : 488f142e
P7 : 6259 P8 : e1 P9 : system.windows.markup.xamlparse.
And i have defined in App.xaml thsi resource for my Main Windows:
<Application x:Class="FirstC1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Window1.xaml">
<Application.Resources>
<SolidColorBrush x:Key="base_color" Color="#FF007D5A" />
<SolidColorBrush x:Key="selection" Color="#FF00422F" />
<Style x:Key="chart_border" TargetType="{x:Type Border}">
<Setter Property="BorderBrush" Value="{StaticResource base_color}"/>
<Setter Property="CornerRadius" Value="5"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="Margin" Value="2"/>
<Setter Property="Padding" Value="2"/>
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush Opacity="0.25" StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="Transparent" Offset="0"/>
<GradientStop Color="{Binding Source={StaticResource base_color},Path=Color}" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
<!-- samples that can not be shown in XBAP -->
<Visibility x:Key="uiVisibilty">
Visible
</Visibility>
<Style TargetType="{x:Type TabItem}" x:Key="tree">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid>
<Border
Name="Border"
BorderBrush="Black"
Background="Gold"
BorderThickness="1,1,1,1"
CornerRadius="25,5,0,0">
<ContentPresenter x:Name="ContentSite"
VerticalAlignment="Center"
HorizontalAlignment="Center"
ContentSource="Header"
Margin="12,0,12,0" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background" Value="White" />
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter TargetName="Border" Property="Background" Value="LightGray" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="FirstCell">
<StackPanel Orientation="Horizontal">
<CheckBox Name="chk1" IsChecked="{Binding Path=IsSelected,
RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}"/>
</StackPanel>
</DataTemplate>
</Application.Resources>
</Application>
Thanks in advance.
|
|
|
|
|
And what have Visifire said?
"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
|
|
|
|
|
To use visifire, it's important to create a chart in a constructor or windows before use it in other function in a csharp code. I have so many errors in deploymnt of my application in WPF. Do you think in this case that it's an error in my app.xaml, specifically in a gradientbrush?
|
|
|
|
|
I am building a Silverlight 3 application using MSBuild. I am attempting to POST data in a HttpWebRequest, and I get error CS1061:
'System.Net.HttpWebRequest' does not contain a definition for 'ContentLength'. Here is a code snippet:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.Method = "POST";
// Create POST data and convert it to a byte array.
string postData = "&amp;items=7";
postData += "&amp;data="+String.Format("{0}", recnbr);
postData += "&amp;delay=false";
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
request.ContentLength = byteArray.Length; [ERROR HERE]
request.ContentType = "application/x-www-form-urlencoded";
I also get the same error for 'GetRequestStream'.
Searching the Internet, I found no answers. Can anyone help?
|
|
|
|
|
Siberz wrote: 'System.Net.HttpWebRequest' does not contain a definition for 'ContentLength'.
Correct. This property is not available in the
Silverlight .NET Framework. I believe the system sets
this for you based on how much data is written to the
request stream. See the "Remarks" section here:
HttpWebRequest.Headers Property[^]
Siberz wrote: I also get the same error for 'GetRequestStream'.
You'll need to use BeginGetRequestStream() and EndGetRequestStream()
in Silverlight.
Siberz wrote: Searching the Internet, I found no answers.
Silverlight Documentation[^]
HttpWebRequest Members[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have a class which builds cubes.One of its properties is to translate to diffrent part of the screen.
testCube is object of that class.
testCube.Translate = new TranslateTransform3D(0, -1, 1);
I would like to set binding for Translation, but I am having hard time.
Looking the book WPF in Action I found this code for Rotation.
AxisAngleRotation3D angleRot = new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0);
RotateTransform3D rot = new RotateTransform3D(angleRot,new Point3D(-spaceToUseX + (spaceToUseX / 2), 0, -(barWidth / 2)));
Binding rotBind = new Binding("Value");
rotBind.Source = rotateSlider;
BindingOperations.SetBinding(angleRot,
AxisAngleRotation3D.AngleProperty, rotBind);
model.Transform = rot;
I wrote this code, but nothing happends.It runs, with no errors
Binding TransformBindingX = new Binding("CubeUnit");
TransformBindingX.Path = new PropertyPath("Translate.OffsetX");
Binding TransformBindingY = new Binding("CubeUnit");
TransformBindingY.Path = new PropertyPath("Translate.OffsetY");
Binding TransformBindingZ = new Binding("CubeUnit");
TransformBindingZ.Path = new PropertyPath("Translate.OffsetZ");
TranslateTransform3D translateTransform3D = new TranslateTransform3D();
BindingOperations.SetBinding(translateTransform3D, TranslateTransform3D.OffsetXProperty, TransformBindingX);
BindingOperations.SetBinding(translateTransform3D, TranslateTransform3D.OffsetYProperty, TransformBindingY);
BindingOperations.SetBinding(translateTransform3D, TranslateTransform3D.OffsetZProperty, TransformBindingZ);
Any Idea?
Best regards
Agha
|
|
|
|
|
Hai to all,
I am developing a sample animation application. while i run this application it shows the following errors. I don't know why this error was occured. The application usage memory was increases simultaneously while running the application. How to solve this error. If anybody had the solution for this error please reply this post.
System.Windows.Media.Imaging.BitmapSourceSafeMILHandle.ComputeEstimatedSize(IntPtr bitmapObject)
at System.Windows.Media.Imaging.BitmapSourceSafeMILHandle.CalculateSize()
at System.Windows.Media.Imaging.UnmanagedBitmapWrapper..ctor(BitmapSourceSafeMILHandle bitmapSource)
at System.Windows.Media.Effects.BitmapEffect.GetOutput(SafeHandle unmanagedEffect, Int32 index, BitmapEffectRenderContext context)
at System.Windows.Media.Effects.BitmapEffect.GetOutput(BitmapEffectInput input)
at System.Windows.Media.Effects.BitmapEffectState.GetEffectOutput(Visual visual, RenderTargetBitmap& renderBitmap, Matrix worldTransform, Rect windowClip, Matrix& finalTransform)
at System.Windows.Media.Effects.BitmapEffectVisualState.RenderBitmapEffect(Visual visual, Channel channel)
at System.Windows.Media.Effects.BitmapEffectContent.ExecuteRealizationsUpdate()
at System.Windows.Media.RealizationContext.RealizationUpdateSchedule.Execute()
at System.Windows.Media.MediaContext.Render(ICompositionTarget resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at AnimateApplication.App.Main()
damodharan
|
|
|
|
|
There are so many types of animations and without more information it looks no one able to help you.
Best regards
Agha
|
|
|
|
|
when i try to run my silver light 3 application i m getting the following message
"The Silverlight managed debugging package isn't installed"
pls help me to get out of this mess
|
|
|
|
|
Have you installed the Silverlight Tools for
Visual Studio?
Silverlight: Get Started[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
No you need the Developer runtime
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
i have same error ,i installed MS silverlight,MS Silverlight SDK 3 ,MS Silverlight tools for VS 2008......
any help
|
|
|
|
|
Hello.
What is the XAML code of a WPF's TreeView Separator ?
I've been using <Separator /> , But this one is selectable ! I'm looking for a non-selectable Separator Tag !
Could you please guide me ?
Thanks in advance.
|
|
|
|
|
You can add a IsSeparatorBefore property to your view model objects, and have your DataTemplate draw the separator above the item if the property is true. You can use a negative top margin to have it appear above the selection.
Alternatively you can implement an attached property called IsSelectable that you can attach to your separator element. In the behavior of the property catch the PreviewMouseDown event and mark it as handled.
Also you can try to set IsEnabled to false on the separator, not sure that property is available on it.
|
|
|
|
|
Aviad P. wrote: You can add a IsSeparatorBefore property to your view model objects, and have your DataTemplate draw the separator above the item if the property is true. You can use a negative top margin to have it appear above the selection.
Unfortunately I couldn't understand the concept of view model objects.
Aviad P. wrote: Also you can try to set IsEnabled to false on the separator, not sure that property is available on it.
I tried it, when I set IsEnabled property to false , it's selectable again.
|
|
|
|
|
|
I have a dialog in using C#.
I need to put a button using WPF, XAML.
How can i do this working?
|
|
|
|
|
Hi
I am working on a project in which Computer interact with some Microcontroller
Computer sends some commands in a particular protocol, and receive some data in turn
There is a problem:
we have lots of Microcontroller connected to a computer via serial port,
because serial port is another thread, we send command from computer
but we don't know when exactly we receive the response of MicroController
as we have lots of MicroController connected to computer, we can not have lots of delay for each command sending
so I used a Interrupt based (Event Oriented) code, but
you suppose I send a command to a MicroControler , but don't wait for response
and send another command to another MicroController, ...
at the other hand , we are receiving some data,
that they are the responses
the problem is here: we can not distinguish which response belong to with MicroContoller
is there a solution for this problem?
is it a multiThreading problem?
|
|
|
|
|
its not clear from what you've said what the relationshop between serial port and microcontroller is - without that, questions like 'is there a solution for this problem' && 'is it a multihreading problem' are real hard to answer - and to throw multithreading into the mix may make you're life harder !!
So, if one serial port has multiple microcontrollers attached to it, Im guessing there must be a way of adressing each microcontroller on the serial port. As you say,
cppwxwidgetsss wrote: we can not distinguish which response belong to with MicroContoller
which I find hard to visualise, so the only way I see of handling this is to have 1 to 1 relationship between serial-ports and microcontrollers, unless the response from a microcontroller can be improved to say which one its coming from ..
It must be a fairly common issue, so Im wondering if there's a serial I/O board you can use between the serial interface of the pc and the microcontrollers, that you'll know which microcontroller to address and get a unique response back from it
sorry I cant help more
'g'
|
|
|
|
|
actually we have a bus-like serial port which means that we use the serial port in share with lots of microController
and as the protocol is implemented before, we have not any mean to find out which device is sending a message (it is not expected before in protocol)
so that I think this is a multithreading problem
if someone have useful info help me please
|
|
|
|
|
Hi,
I think I understand your problem I take it you are using interrupts with your serial comms as in my article:Serial Communication using WPF, RS232 and PIC Communication[^] . I'm an electrical engineer so I do a lot of work with micro-controllers and programming on UI levels.
From my understanding at the moment the you can not determine which micro-controller has sent the data of which the interrupt loads and displays. There are a few solutions to you problem which depend on your ability to reprogram the micro-controllers.
1st I will assume this is not an option:
If you can ensure that the micro-controllers respond one after each other the you could try the older approach of creating another thread and reading all the data into a buffer this more common in C# applications. I can provide an example of this if required however it's not used that often any more. This will attempt to read the data in a let you deal with it a bit at a time however is less efficient than interrupts and your likely to to loose data.
The best option to ensure data integrity is simply to wait after polling each micro-controller until data is received however I understand this may not be possible if at time the micro-controller does not respond with data. If this is true you will have to introduce a timer to continue after if no data is received.
2nd If you can reprogram the micro-controllers:
This is far easier, 1st simply ensure each micro-controller sends and ID tag before sending any data this way you can determine the start of each package and the device.
An alternative which is the bus standard norm is a busy line. It requires an extra connection between your micro-controllers when a controller receives a request for data it will set this line high. Before any other micro-controller can send it's data it must wait for this line to go low. This method again relies on data always being sent on request and has inherent problems such as if one micro-controller takes a considerable time to transmit for example it has a long string of data to send you could find yourself polling for data from micro-controllers before they have had time to send there previous data. This timing issues are important to deal with and I would recommend the first option for ease as you could still end up with the same problem.
I hope this helps however I do have question if you haven't designed the micro-controllers yourself. If you have your micro-controllers configure on one comms line i.e. one TX and RX line in a bus configuration a busy line should have already been employed else there is nothing to stop your micro-controllers sending data over the top of each other. I would unfortunately expect that this is true in which you could still have the problem you described. Your easiest solution would be to wait to receive data from a micro controller before requesting more. This can still be done extremely fast.
Feel free to ask further questions
Cheers
Chris
|
|
|
|
|