Click here to Skip to main content
15,897,187 members
Home / Discussions / WPF
   

WPF

 
QuestionSilverlight : Changing theme at run-time Pin
Prasoon Chaudhary28-Jul-10 23:24
Prasoon Chaudhary28-Jul-10 23:24 
QuestionAlternative to "DropDownWidth" Property for Combo Box in WPF. Pin
dashingsidds28-Jul-10 23:01
dashingsidds28-Jul-10 23:01 
QuestionHow to do UI Design that fix in all the screen size Pin
Joe Rozario28-Jul-10 20:56
Joe Rozario28-Jul-10 20:56 
AnswerRe: How to do UI Design that fix in all the screen size Pin
Pete O'Hanlon28-Jul-10 22:04
mvePete O'Hanlon28-Jul-10 22:04 
GeneralRe: How to do UI Design that fix in all the screen size Pin
Joe Rozario29-Jul-10 2:42
Joe Rozario29-Jul-10 2:42 
QuestionDataVisualization Library Binding Question [SOLVED] Pin
#realJSOP28-Jul-10 9:21
professional#realJSOP28-Jul-10 9:21 
QuestionHow To Create This Trigger Pin
Kevin Marois28-Jul-10 8:47
professionalKevin Marois28-Jul-10 8:47 
QuestionNeed help with this control alignment issue Pin
Michael Eber27-Jul-10 11:59
Michael Eber27-Jul-10 11:59 
I'm almost bald from pulling my hair out over this bug.
I have a WPF window which as a section defined as follows:
XML
<StackPanel Name="stackPaneln" Orientation="Horizontal" Margin="-1,29,0,54">
    <DockPanel Name="navigation" >
    <StackPanel Name="stackPanel1" Width="162" HorizontalAlignment="Left" Height="486">
        <Button Height="103" Name="configurationViewerRequest" Width="120" Margin="0,5" Click="configurationViewerRequest_Click">
            <StackPanel Orientation="Vertical">
                <Image Source="Configuration_icon_by_obsilion.png" Height="73" />
                <TextBlock Text="Configuration" TextAlignment="Center" Margin="0,5,0,0" />
            </StackPanel>
        </Button>
        <Button Height="100" Name="systemStatus" Width="120" Margin="0,5" Click="systemStatus_Click">
            <StackPanel Orientation="Vertical">
                <Image Source="SystemMonitor.png" Height="73" />
                <TextBlock Text="System Status" TextAlignment="Center" Margin="0,5,0,0" />
            </StackPanel>
        </Button>
        <Button Height="103" Name="systemMonitor" Width="120" Margin="0,5" Click="systemMonitor_Click">
            <StackPanel Orientation="Vertical">
                <Image Source="ViewInfo.png" Height="73" />
                <TextBlock Text="System Monitor" TextAlignment="Center" Margin="0,5,0,0" />
            </StackPanel>
        </Button>
    </StackPanel>
    </DockPanel>
    <DockPanel Name="destination" Margin="10,0,0,0" Width="608">
    </DockPanel>
</StackPanel>


The problem:

When one of the buttons in the Navigation panel is clicked, the user control that provides the functionality is loaded into the 'destination' dock panel. So I have a user control which has a treeview and an editor window. In the editor window I put a label with content = '<----the navigation of over there'

When the configuration button is clicked I create an instance of the editor, and do destination.Children.Add(controlEditor);
Problem: the control is shifted all the way to the right of the window (aligned with x=0 of the Window!!! instead of the DockPanel!!!!

Here is the xaml of the control I'm loading in case I screwed up there....

XML
<UserControl x:Class="SnmpBrowser.ConfigurationManager"
	  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
	  mc:Ignorable="d" xmlns:ig="http://schemas.infragistics.com/xaml" d:DesignHeight="612" d:DesignWidth="800">

	<Grid>
		<DockPanel VerticalAlignment="Top" Height="536" Margin="12,12,640,64" >
		<TreeView >
			<TreeView.ContextMenu x:Uid="addItemContext">
				<ContextMenu Name="context" Opened= "context_Opened" >
					<MenuItem Name="header" Header="populated programmatically" >
						<MenuItem Name="newItem" Header="Add New " Click="newItem_Click" />
						<MenuItem Name="edit" Header="Edit....">
							
						</MenuItem>
					</MenuItem>
				</ContextMenu>
			</TreeView.ContextMenu>
			<TreeViewItem Header="Agent" MouseRightButtonDown="ContextMenuHandler" Uid="agent" MouseEnter="SetSelected" />
			<TreeViewItem Header="Devices" MouseRightButtonDown="ContextMenuHandler" Uid="device" MouseEnter="SetSelected" />
			<TreeViewItem Header="Mother" IsSelected="True" MouseRightButtonDown="ContextMenuHandler" Uid="mother" MouseEnter="SetSelected"></TreeViewItem>
			<TreeViewItem Header="System" MouseRightButtonDown="ContextMenuHandler" Uid="system" MouseEnter="SetSelected" />
		</TreeView>
		</DockPanel>
		<DockPanel Margin="0,12,12,0" Name="destination" VerticalAlignment="Top" Height="536" HorizontalAlignment="Right" Width="622">
			<Label Content="&lt;-------- the menu is over there!" Height="28" Name="label1" />
		</DockPanel>
		<ListBox Height="Auto" HorizontalAlignment="Stretch" Margin="12,552,0,0" Name="messages" VerticalAlignment="Stretch" Width="Auto" />

	</Grid>
</UserControl>

AnswerRe:control alignment issue solved Pin
Michael Eber28-Jul-10 5:24
Michael Eber28-Jul-10 5:24 
QuestionBinding Question! Pin
Jammer27-Jul-10 6:10
Jammer27-Jul-10 6:10 
AnswerRe: Binding Question! Pin
Ravi Mori28-Jul-10 0:44
Ravi Mori28-Jul-10 0:44 
AnswerRe: Binding Question! Pin
Pete O'Hanlon28-Jul-10 2:17
mvePete O'Hanlon28-Jul-10 2:17 
QuestionHow to write small application that show 4 images in 3D ? Pin
Yanshof27-Jul-10 3:22
Yanshof27-Jul-10 3:22 
AnswerRe: How to write small application that show 4 images in 3D ? Pin
Abhinav S27-Jul-10 6:05
Abhinav S27-Jul-10 6:05 
QuestionHow to stretch Colum header in WPF datagrid? Pin
makumazan8427-Jul-10 0:06
makumazan8427-Jul-10 0:06 
AnswerRe: How to stretch Colum header in WPF datagrid? Pin
Pete O'Hanlon27-Jul-10 0:30
mvePete O'Hanlon27-Jul-10 0:30 
QuestionHow to bind the Stackpanel object into ListView Pin
DavJes26-Jul-10 2:00
DavJes26-Jul-10 2:00 
AnswerRe: How to bind the Stackpanel object into ListView Pin
Michael Eber27-Jul-10 17:38
Michael Eber27-Jul-10 17:38 
GeneralRe: How to bind the Stackpanel object into ListView Pin
DavJes4-Aug-10 21:41
DavJes4-Aug-10 21:41 
GeneralRe: How to bind the Stackpanel object into ListView Pin
Michael Eber5-Aug-10 7:08
Michael Eber5-Aug-10 7:08 
QuestionRemoving specific object from a container and add it to another Pin
sadas232341s24-Jul-10 3:48
sadas232341s24-Jul-10 3:48 
AnswerRe: Removing specific object from a container and add it to another Pin
Parwej Ahamad24-Jul-10 7:30
professionalParwej Ahamad24-Jul-10 7:30 
AnswerRe: Removing specific object from a container and add it to another Pin
Michael Eber27-Jul-10 12:10
Michael Eber27-Jul-10 12:10 
QuestionData binding to static resource: shown to work in VS but not when run Pin
Jonathan Davies24-Jul-10 2:36
Jonathan Davies24-Jul-10 2:36 
AnswerRe: Data binding to static resource: shown to work in VS but not when run Pin
Pete O'Hanlon24-Jul-10 4:25
mvePete O'Hanlon24-Jul-10 4:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.