|
I should probably point out that the UI's that I build are VERY graphic in nature with borderless nonsizeable main windows with irregular shaped graphic backgrounds. All Buttons, radios, checkboxes, sliders and other basic controls are designed by a graphic designer and then sliced up for the GUI. These are NOT standard UI's. The GUI's are used for small utility setting setup (think tooltray app for setting up some small feature) or they are internal tools that are used by non computer people or used as a demo on a large screen or demo room with specific hardware to demonstrate a feature.
That said...how do I "Dump out" a control template?
|
|
|
|
|
Yeah, I get it. As I said in my original response, that is how you did it in Win32 / MFC / Winforms, etc. If you are going to do WPF, you should use the WPF mechanisms. Otherwise, why bother? Not trying to be a dick, just saying lol... If you are not going to do that... might as well stick with Winforms, as you won't get any of the WPF advantages.
You will be surprised what can be drawn with WPF primitives... there's a guy on here who is a REAL stud at that...
[^]
[^]
[^]
are just some examples.
download a copy of Expression Blend (a Microsoft app) and you can drag a control on a form, right click and dump out the template. You'll get full compilable XAML, all the brushes, resources, etc.
You'll notice EVERYTHING... buttons, checkboxes, radio buttons, etc. are all drawn with XAML.
Honestly, if you are working with a photoshop graphic designer (traditional), you might as well skip WPF as you'll just be piecing together all the graphics Winform style anyways. You really need a designer that knows the WPF tools (Expression Blend, Sketch Flow, etc). Should not be too hard for a photoshop guy to learn Expression Blend (if he is interested) as it pretty much works the same way... drop primitives like lines, curves, gradients, etc. on the form and do stuff.
You ***WILL*** need to draw ***EVERYTHING*** using XAML primitives if you want to do the fancy WPF stuff... animations, fading, special fx, etc.
|
|
|
|
|
how can change selected node in treeview with mouse right click without writing handler in code behind.
|
|
|
|
|
I'm stuck here guys. I could really use another pair of eyes on this.
I have a treeview. It's bound to an ObservableCollection<treenode> called Nodes. The bound data on the tool tips is not showing:
<controls:TreeViewEx BorderThickness="0"
ItemsSource="{Binding Nodes}"
SelectedItemEx="{Binding SelectedTreeNode, Mode=TwoWay}">
<controls:TreeViewEx.ToolTip>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0"
Grid.Column="0"
Source="/FMG.UI.WPF;component/Media/Images/job_128.png"
Height="16"
Width="16"/>
<TextBox Grid.Row="0"
Grid.Column="1"
Text="Job: "
FontWeight="Bold"/>
<TextBox Grid.Row="0"
Grid.Column="2"
Text="{Binding ToolTipHeader}"/>
<Border Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="3"
Height="2"
BorderBrush="Gray"/>
<TextBox Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="3"
Text="{Binding ToolTipDetails}"/>
</Grid>
</controls:TreeViewEx.ToolTip>
</controls:TreeViewEx>
The tooltip pops up, but the ToolTipHeader and and ToolTipDetails are blank. The Output window says it can't find them on the view model. How do I make the binding look on the Node, not the view model?
Thanks
If it's not broken, fix it until it is
modified 28-Jan-13 23:04pm.
|
|
|
|
|
Hi Kevin,
what is the DataContext of the ToolTip?
Because the bindings look at e.g. DataContext.ToolTipHeader .
Have a look at what Karl Shifflett did here: http://karlshifflett.wordpress.com/2007/12/29/wpf-sample-series-data-binding-in-tooltip/[^]
If you change <controls:TreeViewEx.ToolTip> to:
<controls:TreeViewEx.ToolTip>
<ToolTip DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}">
<Grid></Grid>
</ToolTip>
</controls:TreeViewEx.ToolTip>
And change the binding of the textbox to e.g. Text="{Binding SelectedItemEx.ToolTipHeader}"
then it should work, if SelectedItemEx has the property ToolTipHeader .
But you realize that you define a tooltip for the whole treeview control and not for each treeview node, right?
Of course, if the tooltip has already as datacontext your viewmodel then Text="{Binding SelectedTreeNode.ToolTipHeader}"
should work too (without setting the ToolTip DatContext=...) stuff.
Bye,
Thomas.
|
|
|
|
|
Hello!
I have a treeview:
<TreeView
BorderBrush="Black"
BorderThickness="2"
Cursor="Hand"
ItemsSource="{Binding Data, UpdateSourceTrigger=PropertyChanged}" >
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter
Property="IsSelected"
Value="{Binding SelectedPath, Mode=TwoWay}" />
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate
ItemsSource="{
Binding Persons,
UpdateSourceTrigger=PropertyChanged}"
DataType="{x:Type local:Data}" >
<Grid>
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="dane" Text="{Binding ID}" Margin="0,0,5,0" />
<Button
Style="{StaticResource ButtonLikeTextBlock}"
Content="{Binding DataOrName}"
Command="
{Binding
Path=DataContext.DisplayInfoCommand,
RelativeSource = {RelativeSource FindAncestor, AncestorType={x:Type Window}}}" />
</StackPanel>
</Grid>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
How can i get the ID property which is in Persons list ? How can i bind it straight to viewmodel class? Can u show sample code?
Greetings, Boryborawski.
|
|
|
|
|
Hello,
I'm building WPF(MDI) application.
I want my main window to have some constant header and footer(like in a browser) and the area between the header and the footer will change dynamically.
I googled but didn't find any thing useful, can someone help on this one?
Thanks
|
|
|
|
|
|
Hello,
I'm using WPF.MDI.dll assembly in my project.
This is my Main window XAML file:
<Window x:Class="PL.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mdi="clr-namespace:WPF.MDI;assembly=WPF.MDI"
Title="MainWindow" Height="400" Width="800">
<DockPanel>
<mdi:MdiContainer>
</mdi:MdiContainer>
</DockPanel>
</Window>
As soon as i added the lines:
<mdi:MdiContainer>
</mdi:MdiContainer>
I got the next message at the designer:
System.NullReferenceException<br />
Object reference not set to an instance of an object.<br />
at WPF.MDI.MdiContainer.MdiContainer_Loaded(Object sender, RoutedEventArgs e)<br />
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)<br />
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)<br />
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)<br />
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)<br />
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)<br />
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)<br />
at MS.Internal.LoadedOrUnloadedOperation.DoWork()<br />
at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()<br />
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()<br />
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)<br />
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)<br />
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)<br />
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
Any body can help me solve the problem?
Thanks!!!
|
|
|
|
|
|
Hey,
I copy pasted this example and still i get the error...
|
|
|
|
|
check your dll assembly.
I implemented it tonight and found no error.
--AP
|
|
|
|
|
hai am also getting same error have you found any solution..?
|
|
|
|
|
I have a application that has a page that receives multiple packets from a TCP/IP server. Every time it receives it tries to run an event using Dispatcher.BeginInvoke which runs the event. The problem is that the event only runs on the first time Dispatcher.BeginInvoke. I believe that the reason for this is that because the thread is already running it can not be started again. Also, I have tried the Backgroundworker class and as soon as it hits my code I get an "Invalid cross thread access" error which makes me put the code back into the Silverlight Dispatcher.BeginInvoke and the origional problem occurs. How do I fix my problem?
Thanks,
Steve Holdorf
-- modified 25-Jan-13 7:06am.
|
|
|
|
|
Without seeing your code it is hard to say. I think the issue here is that you are using the Dispatcher.BeginInvoke which is actually saying, marshal any work onto the UI thread. what could be happening is that if you first action does not complete or blocks the UI then subsequent events may not bubble up to the UI thread which would not show anything.
You were right in trying another thread. Firstly do your work on another thread. At the point of updating the UI, put that bit in the Dispatcher call. So what you are saying is: Do my work on another thread. Once it is complete and I want to update my UI, marshal it onto the UI thread using the dispatcher.
|
|
|
|
|
It is hard for me to cut and paste code because I develop on one network and access the internet on another. But my code looks something like this:
Backgroundworker bw = new Backgroundworker();
public void Constructor ()
{
bw.DoWork += new DoWorkEventHandler(bw_DoWork);
bw.RunWorkerCompleted +=
new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
}
private void Update()
{
bw.bw_DoWorkAsync();
while (!autoEvent.WaitOne())
{
Dispatcher.BeginInvoke(timeline.UpdateEvents)
}
}
private void bw_DoWork(Object sender, DoWorkEventArgs e)
{
Dispatcher.beginInvoke(GetFreshData);
// This event is where I refresh the collection data
}
private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
Dispatcher.BeginInvoke(timeline.UpdateEvents)
//updates the timeline control where my refreshed collecton exists
}
Now, I put a break point in the bw_DoWork and bw_RunWorkerComplete which gets hit every time; however, the timeline control refresh never occurs except for the first time.
Thanks,
Steve Holdorf
-- modified 27-Jan-13 19:17pm.
|
|
|
|
|
What is the Do work complete? also what does the timeline.UpdateEvents do?
Are you using MVVM? I dont think so looking at the code you supplied but just wondered what the actual dataset was that the UI binds too?
|
|
|
|
|
Please remember that the actual code is at my office at work and I am at home. I have network security rules that don't allow me to bring code home. However, this is a Silverlight page control the Do Work Complete bw_RunWorkerCompleted is the Async event that is called once the bw_DoWork is finishes. Now, 'TimeLine timeline' is a codeplex control which is a sub-control on the main page control that displays a Silverlight timeline. How it works is that a wcf call is made which fills the timeline's List<Event> events collection that is a property of the TimeLine control. Now, when timeline.UpdateEvents is called the timeline control iterates the list and re-draws the timeline with each of the collection's event objects. The Backgroundworker class provides an Async run event and on event complete combination. I have to put the 'while (!autoEvent.WaitOne())', sorry I forgot the while in the while loop, to wait until the main thread signals so that the Dispatch.BeginInvoke(timeline.UpdateEvents) is blocked unitl the collection is updated by the wcf call or I get an exception. I know that my discription is a bit sketchy but this is all I can go on as far a specifics until in the morning. If you can help that would be great!
Thanks,
Steve Holdorf
-- modified 27-Jan-13 20:31pm.
|
|
|
|
|
I have created a simple silverlight application in VS2010(Silverlight 5) for open exe file. I host the application on my iis 7 and it is working fine. when i host in online(server), the elevated permission is failed and not entered to automationfactory. kindly suggest for open exe in online.
Thanks in advance.
|
|
|
|
|
You cannot open exe files in Web browsers, it would compromise the security of the client system.
|
|
|
|
|
Hello Richard,
Thank you for reply. Is there any possible way to open exe file(like notepad) on client system through web browser? or any third party tool available?
|
|
|
|
|
Well, as I said before it's a security measure. And indeed, why would you want to open it with Notepad? Maybe you should explain what problem you are trying to solve.
|
|
|
|
|
Hello Richard,
Actually, i used image capturing in my project. I would like to open the saved picture from client machine through web browser, same time i have to save image in database. For that only i simply ask, how to open a file.
|
|
|
|
|
Sorry, I'm not sure how to do that; but you could try a Google search or look on the ASP.NET website for suggestions.
|
|
|
|
|
Hello Code Project,
I have a requirement in Silverlight, that If a TextBox[ContentControl] have validation error, then the appearence should be like a red wavy line, with a tool tip of error content. If it is possible , please help me with a sample silverlight application..
|
|
|
|
|