Hello cSharpies,
I'm building my 1st WPF app and I'd like to get off to a good start, so
experienced advice I'm soliciting.
The application is an explorer like tool with two (2) main sections: 1)
a TreeView on the left and 2) a work Grid on the right (see XAML example
below.) The TreeView will display a hierarchy of Groups and Items; there
may be 1 or more Groups with the same set of Items. Selecting an Item
from the TreeView will display a set of controls in the work Grid. Each
Item's work Grid controls will be different. The same Items from
different groups will have the same work Grid, with different (bound) data.
For a Group and it's Items, I'd like to be able do the layout with the
designer and then use the resulting XAML as a sort of template along
with a class - having a class method load the template at runtime.
Questions:
1. Is this possible and/or advisable? If possible, how?
2. Can the XAML template be pre-compiled in some way to speed loading?
Thanks,
Bill
Example XAML:
<Window x:Class="WpfApp lication1.Windo w1"
xmlns="http://schemas.microso ft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microso ft.com/winfx/2006/xaml"
Height="370" Width="579"
HorizontalAlign ment="Stretch" VerticalAlignme nt="Stretch">
<DockPanel
Height="Auto" Name="dockPanel 1" Width="Auto">
<StatusBar
Height="23" Name="statusBar "
Width="Auto" VerticalAlignme nt="Bottom"
DockPanel.Dock= "Bottom" />
<Menu Height="22" Name="menu1"
Width="Auto" VerticalAlignme nt="Top"
DockPanel.Dock= "Top">
<MenuItem Header="File">
<MenuItem Name="MenuFileE xit"
Header="Exit" Click="MenuFile Exit_Click" />
</MenuItem>
</Menu>
<Grid Height="Auto" Name="grid" Width="Auto">
<Grid.ColumnDef initions>
<ColumnDefiniti on Width="1*"/>
<ColumnDefiniti on Width="3"/>
<ColumnDefiniti on Width="2*"/>
</Grid.ColumnDefi nitions>
<TreeView
Name="treeView" Height="Auto"
Grid.Column="0" Width="Auto">
<TreeViewItem Name="tviGroup" Header="Plant" >
<TreeViewItem Name="tviGroupI tem1" Header="Item2" />
<TreeViewItem Name="tviGroupI tem2" Header="Item2" />
<TreeViewItem Name="tviGroupI tem3" Header="Item3" />
<TreeViewItem Name="tviGroupI tem4" Header="Item4" />
</TreeViewItem>
</TreeView>
<GridSplitter
Name="gridSplit ter" Grid.Column="1"
HorizontalAlign ment="Stretch" />
<Grid
Name="workGrid"
Height="Auto" Width="Auto" Grid.Column="2" >
</Grid>
</Grid>
</DockPanel>
</Window> 4 2728
Hello Bill,
Welcome to Microsoft Newsgroup Support Service! My name is Marco Zhou. It's
my pleasure to work with you on this thread.
1. Is this possible and/or advisable? If possible, how?
I think the design you described above is possible and workable, but I've
no idea which specific issue you are encountering when implementing this
feature/functionality, could you please elaborate a little bit?
2. Can the XAML template be pre-compiled in some way to speed loading?
Yes, you can, you could create the XAML file in visual studio, set its
"Build Action" to "Page", then Visual Studio will invoke the msbuild to
compile the XAML into lightweight/compact BAML (Binary Application Markup
Language) form, then at runtime, you could use Application.Loa dComponent()
method to deserialize the BAML into CLR object graph, passing the pack URI
as parameter.
You could read more about pack URI here: http://msdn.microsoft.com/en-us/library/aa970069.aspx
You could read more about WPF XAML compilation process here: http://msdn.microsoft.com/en-us/library/aa970069.aspx
If you have any further questions on this issue, free feel to ask here, we
are glad to answer them.
--------------------------------------------------
Best regards,
Macro Zhou (v-*****@online.mi crosoft.com, remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at: ms****@microsof t.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
Marco,
My issue is what features of the language to use and how to use them.
Here's an example:
In this TreeView with no items:
<TreeView
Name="treeView" Height="Auto"
Grid.Column="0" Width="Auto">
</TreeView>
that will be part of WpfApplication1 .Window1
I want to have 1 or more of:
< ???? >
<TreeViewItem Name="tviGroup" Header="Plant" >
<TreeViewItem Name="tviGroupI tem1" Header="Item2" />
<TreeViewItem Name="tviGroupI tem2" Header="Item2" />
<TreeViewItem Name="tviGroupI tem3" Header="Item3" />
<TreeViewItem Name="tviGroupI tem4" Header="Item4" />
</TreeViewItem>
</????>
which can be referenced by a class in the same way that
<Window x:Class="WpfApp lication1.Windo w1" ... >
is referenced through
namespace WpfApplication1 {
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window {
public Window1() {
InitializeCompo nent();
}
...
}
}
But if I do this in the XAML:
<Window x:Class="WpfApp lication1.Windo w1" ...... </Window>
<TreeViewItem x:Class="WpfApp lication1.Group ">
... items ...
</TreeViewItem>
I get an error:
Error 2 'There are multiple root elements. Line 28, position 2.' XML
is not valid.
Obviously, there can be only one root element, and for the main form
Window, it needs to be <Window>. So I need to know how to structure the
XAML so that it can be part of some class other than
WpfApplication1 .Window1. Do I use some sort of template feature? Do I
locate the XAML in the Window1.xaml file, or should it be in a separate
file?
Thanks
Bill
Marco Zhou [MSFT] wrote:
Hello Bill,
Welcome to Microsoft Newsgroup Support Service! My name is Marco Zhou. It's
my pleasure to work with you on this thread.
1. Is this possible and/or advisable? If possible, how?
I think the design you described above is possible and workable, but I've
no idea which specific issue you are encountering when implementing this
feature/functionality, could you please elaborate a little bit?
2. Can the XAML template be pre-compiled in some way to speed loading?
Yes, you can, you could create the XAML file in visual studio, set its
"Build Action" to "Page", then Visual Studio will invoke the msbuild to
compile the XAML into lightweight/compact BAML (Binary Application Markup
Language) form, then at runtime, you could use Application.Loa dComponent()
method to deserialize the BAML into CLR object graph, passing the pack URI
as parameter.
You could read more about pack URI here: http://msdn.microsoft.com/en-us/library/aa970069.aspx
You could read more about WPF XAML compilation process here: http://msdn.microsoft.com/en-us/library/aa970069.aspx
If you have any further questions on this issue, free feel to ask here, we
are glad to answer them.
--------------------------------------------------
Best regards,
Macro Zhou (v-*****@online.mi crosoft.com, remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at: ms****@microsof t.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
Hello Bill,
I think you might need to have a quick workthrough or tutorial on XAML to
better understand this declarative UI defintion language, as long as you
get hang of it, you will be more productive: http://msdn.microsoft.com/en-us/library/ms752059.aspx http://www.codeproject.com/KB/WPF/GuidedTourWPF_1.aspx
If you have any questions regarding XAML after finishing reading the
articles above, feel free to post back.
Marco
--------------------------------------------------
Best regards,
Macro Zhou (v-*****@online.mi crosoft.com, remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at: ms****@microsof t.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
Marco,
Awesome links! Thanks.
In the business world that I need to operate in, I am often required to
learn to fly with new technology by the seat of my pants, as it were,
while trying to implement it at the same time; not an easy thing to do!
So I already have a couple of good books on WPF & .NET 3.5 and continue
to read an develop at the same time. It's a lot to learn for a dummy
like me and hard to know what direction to go with little-to-no
experience. That's where smart experienced guys like you come in :)
So now, I do have more more specific question. But I'll leave that to
another post.
Thanks,
Bill
Marco Zhou [MSFT] wrote:
Hello Bill,
I think you might need to have a quick workthrough or tutorial on XAML to
better understand this declarative UI defintion language, as long as you
get hang of it, you will be more productive:
http://msdn.microsoft.com/en-us/library/ms752059.aspx
http://www.codeproject.com/KB/WPF/GuidedTourWPF_1.aspx
If you have any questions regarding XAML after finishing reading the
articles above, feel free to post back.
Marco
--------------------------------------------------
Best regards,
Macro Zhou (v-*****@online.mi crosoft.com, remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at: ms****@microsof t.com.
This posting is provided "AS IS" with no warranties, and confers no rights. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Howard Nease |
last post by:
Hello, everyone. I would appreciate any advice that someone could give me on
my future career path. Here is my situation:
I am a bright Junior in a very well-respected private high school, taking
almost all AP and accelerated classes. I am HIGHLY interested in technology,
more specifically the field of Computer Science and software engineering. I
have heard a whole lot about the fact that the market for software engineers
nowadays is...
|
by: Martin Piper |
last post by:
Hi all.
I've recently landed myself the position of trainee
C++ programmer which I'm extremely pleased about,
but also nervous.
According to the feedback from the interview, I
have a good basic knowledge of C++ (through college)
although my contract states that I must endeavour to
learn more, so my question is - which areas of C++
|
by: Andy Dingley |
last post by:
I've just started on a new project and inherited a huge pile of XSLT
(and I use the term "pile" advisedly !) It runs at glacial speed, and
I need to fix this this.
Platform is MSXML 4 / ASP
Any advice on benchmarking tools / techniques ? I have no budget for
tool-building, so if there's anything already out there, that would be
good to know.
|
by: ma740988 |
last post by:
I'm perusing a slide with roughly 12 bullets spread across 3 pages.
Each bullet reflects 'advice'. I'm ok with all but 1 bullet, more
specifically the bullet that states:
" Avoid the STL unless absolutely necessary "
Now, I'm not acclimated with much C++ history, but something tells me
this is akin to trepidation that surrounded C++ during it's inception?
IOW, is this 'old school' rhetoric or ..... How do you refute this
argument?
|
by: J Rieggle |
last post by:
Hi there,
I am stuck on a problem that relates to eCommerce sites, but isnt ASP.NET
specific (sorry). The ecommerce site is working in the UK, and products
will be sold in pounds stirling. However, should I be presenting the
currency figure in the currency of the visitor? I want to keep the site
simple to begin with, so if I choose to render localized currencies, I
probably need to something similar with the content too. I was...
| |
by: Alan Silver |
last post by:
Hello,
MSDN (amongst other places) is full of helpful advice on ways to do data
access, but they all seem geared to wards enterprise applications. Maybe
I'm in a minority, but I don't have those sorts of clients. Mine are all
small businesses whose sites will never reach those sorts of scales. I
deal with businesses whose sites get maybe a few hundred visitors per
day (some not even that much) and get no more than ten orders per day....
|
by: John Paul |
last post by:
I'm thinking of building an e-commerce site in php.
Anyone got any advice in building one?
What is the best way to implement a payment system?
Are any legal issues involved?
Thanks,
|
by: robert maas, see http://tinyurl.com/uh3t |
last post by:
I'm working on examples of programming in several languages, all
(except PHP) running under CGI so that I can show both the source
files and the actually running of the examples online. The first
set of examples, after decoding the HTML FORM contents, merely
verifies the text within a field to make sure it is a valid
representation of an integer, without any junk thrown in, i.e. it
must satisfy the regular expression: ^ *?+ *$
If the...
|
by: mesut |
last post by:
Hi colleagues,
I need your advice...
I have approx 1,5 years experience with ASP.NET/VB.NET 2005 and I have
to switch over into C# 2005 language. I don't have experience with C#
2005 language. (but 10 years experience in mainframe languagues).
My question is: I need a good book can someone advice it? I'm only
interested in ASP.NET not in windows pages.
|
by: SM |
last post by:
Hello,
I have a index.php template (2 columns). The right columns contains a
bunch of links (interviews, poems, etc...) The left columns contains
the actual article.
So if I click on a link on the right menu, the article shows on the
left column.
The links have an url that look like this:
http://www.myweb/library/?doc=194uf7s39
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |