|
Do you mean editing the objects within Visual Studio as you create them, or editing objects that are displayed in your application at run time? If the former then Visual Studio and Expression Blend provide these facilities.
|
|
|
|
|
Thanks for the reply. No, I mean like a control that you can embed in your own project. Perhaps something with xaml editing possibilities. Like a xamlPad control that can be embedded. Is there such a thing?
Thanks again!
|
|
|
|
|
Sorry, I'm not aware of any. I suggest checking all the WPF articles here on CodeProject and also Google search.
|
|
|
|
|
Hi,
I am developing an UI app, in WPF, for the Log window, I have xaml code
<ListView x:Name="lstViewLogWindow" ItemsSource="{Binding}" Height="152">
<ListView.View>
<GridView>
<GridViewColumn Header="Message_Name" Width="Auto" DisplayMemberBinding="{Binding Path= Message_Name}" />
<GridViewColumn Header="DateTime" Width="Auto" DisplayMemberBinding="{Binding Path= DateTime}" />
</GridView>
</ListView.View>
</ListView>
So, I have a grid view with 2 headers Message_Name and DateTime, and I want to assign the data to the 2 columns... I am not able to get the data displayed by using
lstViewLogWindow.Items.Add(msg);
Actually I want to add some msg into First col and date time into second column,
Please help me in doing this.
Thanks
Ramm
|
|
|
|
|
By adding the item explicitly you are overriding the binding mechanism. You should do it by binding. Assign ListView's DataContext with the list of messages.Something like this,
lstViewLogWindow.DataContext = yourListOfMessages;
|
|
|
|
|
Ya.. But its not displaying the text in 2 columns/.
I added DataContext..
lstViewLogWindow.DataContext = lstViewLogWindow.Items.Add(DateTime.Now);
how to add this to a particular header like DateTime
<pre> <GridView>
<GridViewColumn Header="Message Name" Width="Auto" DisplayMemberBinding="{Binding Path= Message_Name}" />
<GridViewColumn Header="DateTime" Width="Auto" DisplayMemberBinding="{Binding Path= DateTime}" />
</GridView></pre>
Pleaes help
Thanks
Ramm
|
|
|
|
|
You have misunderstood what I said. Assign the LIST of MESSAGE to the DataContext.
e.g.,
lstViewLogWindow.DataContext = yourListOfMessages;
where yourListOfMessages is something like 'List<YourMessageType> ' and YourMessageType is a type having Message_Name and DateTime property
|
|
|
|
|
sorry..
really I couldnt get u..
actually as I have 2 columns Message Name and Datetime in my design,
yourListOfMessages will be
1. _eventAggregator.GetEvent<StatusBarMsgShowEvent>().Publish("Click on Save to save the Log window Details"); ------------ to be assigned to column1
2 . DateTime.now ----------- to be assigned to column2...
I think I am not getting you wat U said.. but I am expecting this.. in my logwindow
---------------------------------------------------------------------------------
Message DateTime
Click on Save to save the Log window Details 09/08/2009 12:15:20AM
--------------------------------------------------------------------------------
Thank you,
Ramm
|
|
|
|
|
This is my best attempt.
public class LogMessage
{
public string Message_Name { get; set; }
public DateTime LogTime { get; set; }
}
Then you have your list of messages like this,
List<LogMessage> messages = new List<LogMessage>();
messages.Add(new LogMessage(){Message_Name = "Dummy Message", LogTime = DateTime.Now});
lstViewLogWindow.DataContext = messages;
|
|
|
|
|
HI..
Thanks for the help.
But I am doing this using subscribe and publish..
public class LogWindowMsgShowEvent : CompositePresentationEvent<string>
{
}
_eventAggregator.GetEvent<LogWindowMsgShowEvent>().Subscribe(this.ShowMessage);
_eventAggr.GetEvent<StatusBarMsgShowEvent>().Publish("Database Connection Error");
so, in CompositePresentationEvent&lt;string&gt;
I can see a string here.. do I need to add the class Logwindow to the CompostePresentationEvent??
Actually both the CompositePresentationEvent and the presenter it accesses are in diff modules...
HOw to handle this/
Please help
Thanks
Ramm
|
|
|
|
|
Hi,
I am developing an windows UI application in WPF with MVP architecture with C#.
The application will interact to sqlserver and displays the data to the user.
I have 2 buttons REFRESH and RESET. which refreshes the page and resets the page to the home page respectively.
As I searched in few forums,navigationservice is recommeneded,but I couldnt see navigationservice.refresh() command
Refresh should refresh the page (current page) and the reset should reset to the homepage as per my appication.
Edited part::
My Xaml is inside Window, but not page. I think this is the main reason, I cant see it..
so , how to handle it for window??
Please help me in doing this. Thanks Ramm
modified on Tuesday, September 8, 2009 12:53 PM
|
|
|
|
|
The issue is simple, I am printing a visual captured from a canvas however I do not print the dark coloured background of the canvas therefore any white text inside labels, textboxes etc. are no longer visible.
Is there a best practice for solving this problem?
|
|
|
|
|
Probably best to change the white text to some other (darker) colour.
|
|
|
|
|
Ok apologies for the ambiguity of my post to warrant such a sarcastic reply
I assumed it would have been a common talked about problem but maybe not.
The problem is changing the colour of certain text from white to black whilst printing since the text would not be visible on white paper.
I was hoping for suggestions on how I should implement the changes during printing.
Example have a printing state that when set fires a multi trigger defined for a textbox's style that will set any white foreground black????
Any ideas?
|
|
|
|
|
DavidRen23 wrote: Example have a printing state that when set fires a multi trigger defined for a textbox's style that will set any white foreground black????
Could you clarify this statement please? How have you implemented your print functionality?
|
|
|
|
|
The code for printing is below however the problem cannot be solved here can it? The canvas background is not white, therefore white text appears fine, when printing the content of the canvas is printed on to white paper therefore the text is not visible.
<code>
PrintDialog printDlg = new System.Windows.Controls.PrintDialog();
DesignerCanvas designerCanvas = BloggsSDK.Windows.VisualTreeHelper.FindChild<DesignerCanvas>(this);
if (designerCanvas != null)
{
try
{
System.Printing.PrintCapabilities capabilities = printDlg.PrintQueue.GetPrintCapabilities(printDlg.PrintTicket);
//get scale of the print wrt to screen of WPF visual
double scale = Math.Min(capabilities.PageImageableArea.ExtentWidth / designerCanvas.ActualWidth, capabilities.PageImageableArea.ExtentHeight / designerCanvas.ActualHeight);
Rect bounds = VisualTreeHelper.GetDescendantBounds(designerCanvas); // not extent bounds
bounds.Scale(scale, scale);
DrawingVisual visual = new DrawingVisual();
using (DrawingContext dc = visual.RenderOpen())
{
VisualBrush vb = new VisualBrush(designerCanvas);
vb.Transform = new ScaleTransform(designerCanvas.ActualWidth / (Zoom * designerCanvas.ActualWidth), designerCanvas.ActualHeight / (Zoom * designerCanvas.ActualHeight));
dc.DrawRectangle(vb, null, new Rect(new Point(), bounds.Size));
}
printDlg.PrintVisual(visual, "Workspace printout");
}
catch (Exception ex)
{
}
</code>;
|
|
|
|
|
Sorry, you got me there, I have not used these methods for printing. Anyone else any ideas out there?
|
|
|
|
|
Hello,
I have a problem writing a unit test for a algorithm that calculates the position of some controls. The problem is that some assertions fail because setting a property does not immediately update all other Properties that depend on its value.
For example the following assertion fails (Button.Width is a DependencyProperty):
button.Width = 123;
Assert.AreEqual(123, button.ActualWidth);
This assertion fails because the layout is not immediately updated by the WPF after setting the Width Property.
My concrete scenario looks like this:
1. Set up the test with a window with some child controls
2. Simulate moving a item by the user (done with an associated AutomationPeer and a Move Method). This affects the Center property and implicitly the ActualCenter property of the item.
3. Call the Layout Algorithm that I want to test. In order to calculate the bounds of the items the Layout Algorithm uses Properties like ActualWidth, ActualHeight and ActualCenter as well as the FrameworkElement.TransformToVisual() method.
4. execute assertions that test if the Layout Algorithm works correctly.
[TestMethod()]
public void LayoutTest()
{
ItemPeer1.Move(50, 100);
LayoutAlgorithm.Layout(TheScatterView);
Assert.AreEqual(new Point(50, 100), Item1.Center);
Assert.AreEqual(new Point(200, 100), Item2.Center);
}
The assertions in step 4 fail because the layout algorithm (step 3) gets obsolete information about the center of the moved item. May be the algorithm works correct but I cannot test it.
How can I get this Unit Test working? Do I have to force WPF to update the layout? How?
A solution for the first example with the button might be sufficient to help me:
button.Width = 123;
DoSomethingSoThatActualWidthGetsUpdated();
Assert.AreEqual(123, button.ActualWidth);
|
|
|
|
|
Hi,
I am working on a silverlight project in this I wrote a WCF service to upload images to the SQL database. For some images it is working and I am able to save the images in the database but for some images I am getting an exception like
"An exception occurred during the operation, making the result invalid. Check InnerException for exception details."
All the images I am trying to upload are .png or .jpeg. I But even these are not working.
If anyone have any idea to solve this please reply me.
Thanks in advance.
|
|
|
|
|
Nekkantidivya wrote:
"An exception occurred during the operation, making the result invalid. Check InnerException for exception details."
Whats the InnerException?
|
|
|
|
|
Give your web service method signature and exception details.
|
|
|
|
|
Hi,
I am working on silver light application. In this I converted an image into byte format and saved it in the database. Then I retrieved them from the server and tried to convert it to bitmap and display it in a image control. But during convertion process from byte[] to Bitmap I am getting this exception.
"Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"
List<AdImages> ImgList = new List<AdImages>();
ImgList = e.Result;
int i = 0;
foreach (AdImages img in ImgList)
{
try
{
BitmapImage image = new BitmapImage();
using (MemoryStream stream = new MemoryStream(img.ImgData))
{
image.SetSource(stream); // exception raised at this line
ImgSQL.Source = image;
}
Image img2 = new Image();
img2.Source = image;
LayoutRoot.Children.Add(img2);
posImage(img2, i, ImgList.Count);
_images.Add(img2);
i++;
}
catch (Exception ee)
{
}
}
If anyone any idea to solve this please reply me.
Thanks in advance.
|
|
|
|
|
try with dispatcher..
Dispatcher.BeginInvoke(delegate()
{
List<AdImages> ImgList = new List<AdImages>();
ImgList = e.Result;
int i = 0;
foreach (AdImages img in ImgList)
{
try
{
BitmapImage image = new BitmapImage();
using (MemoryStream stream = new MemoryStream(img.ImgData))
{
image.SetSource(stream); // exception raised at this line
ImgSQL.Source = image;
}
Image img2 = new Image();
img2.Source = image;
LayoutRoot.Children.Add(img2);
posImage(img2, i, ImgList.Count);
_images.Add(img2);
i++;
}
catch (Exception ee)
{
}
}
});
|
|
|
|
|
check that the image format is supported
|
|
|
|
|
i am facing the same problem in Silverlight 4 , did you resolve the Error ?
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/
|
|
|
|