Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
AnswerRe: Help!!! Search Algorithms Pin
chipchip_boy31-May-12 21:15
chipchip_boy31-May-12 21:15 
Questionnested HTML table and xpath: matching level one child node (without hardcoding entire xpath using single forward slashes) Pin
devvvy25-May-12 17:50
devvvy25-May-12 17:50 
AnswerRe: nested HTML table and xpath: matching level one child node (without hardcoding entire xpath using single forward slashes) Pin
PIEBALDconsult1-Jun-12 12:18
mvePIEBALDconsult1-Jun-12 12:18 
QuestionWpf c# dynamicaly added canvas margin or top - right properties are always zero Pin
ChristoforosKor25-May-12 17:30
ChristoforosKor25-May-12 17:30 
AnswerRe: Wpf c# dynamicaly added canvas margin or top - right properties are always zero Pin
Pete O'Hanlon25-May-12 21:56
mvePete O'Hanlon25-May-12 21:56 
GeneralRe: Wpf c# dynamicaly added canvas margin or top - right properties are always zero Pin
ChristoforosKor26-May-12 4:26
ChristoforosKor26-May-12 4:26 
GeneralRe: Wpf c# dynamicaly added canvas margin or top - right properties are always zero Pin
AmitGajjar27-May-12 19:56
professionalAmitGajjar27-May-12 19:56 
GeneralRe: Wpf c# dynamicaly added canvas margin or top - right properties are always zero Pin
ChristoforosKor28-May-12 21:10
ChristoforosKor28-May-12 21:10 
Hi amitgajjar,


1)This is my user control that has a canvas in it. This is the user control I add into the parent canvas.

<UserControl x:Class="Aluminium.usercontrols.ShutterUI"
             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" 
             xmlns:vm="clr-namespace:Aluminium.viewmodels"      
             xmlns:cnv="clr-namespace:Aluminium.converters"
             xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"  >
    <UserControl.Resources>
        <!--<cnv:DataSideToThicknessConverter x:Key="sideToThick" />-->
    </UserControl.Resources>
    <Canvas Name="VisualCanvas" Background="AliceBlue" VerticalAlignment="Stretch" Width="{Binding Path=OpticalWidth}" Height="{Binding Path=OpticalHeight}"  >
        <Border BorderThickness="{Binding Path=BorderThickness}" Name="CanvasBorder" BorderBrush="Black" Width="{Binding ElementName=VisualCanvas, Path=Width}" Height="{Binding ElementName=VisualCanvas, Path=Height}">
            <Canvas  Name="ShutterCanvas" Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" >
                <StackPanel>
                    <Label Name="ShutterLabel" Content="{Binding Path=ShutterLabel}" />
                    <Label Name="ShutterHeightValue" VerticalAlignment="Center" HorizontalAlignment="Center" Content="{Binding Path=Height}" />
                    <Label Name="ShutterWidthValue" VerticalAlignment="Center" HorizontalAlignment="Center" Content="{Binding Path=Width}"/>
                </StackPanel>
             </Canvas>
        </Border>
    </Canvas>
</UserControl>


2) This is how I add this user control to the parent Canvas. VisualCanvas is the parent canvas. FocusedCanvas is a data object. Offset is the length in pixels from the top of the parent canvas, where I insert the child canvas. The counter (i) takes the value 1 or 2 because each time I add 2 canvases together.

this._helper.FocusedCanvas.VisualCanvas.Children.Add(sui);
Canvas.SetTop(this._helper.FocusedCanvas.VisualCanvas.Children[i], offset);


After that if I try to read the margins and top values for the user control itself I get :

a)((ShutterUI)(this._helper.FocusedCanvas.VisualCanvas.Children[i])).Margin = {0,0,0,0}
b)Canvas.GetTop(((ShutterUI)(this._helper.FocusedCanvas.VisualCanvas.Children[i]))) = 0.0


and if I try to read the margins and the top values of the included canvas I get :

a)((ShutterUI)(this._helper.FocusedCanvas.VisualCanvas.Children[i])).VisualCanvas.Margin = {0,0,0,0}
b)Canvas.GetTop(((ShutterUI)(this._helper.FocusedCanvas.VisualCanvas.Children[i])).VisualCanvas) = NaN


any help is appreciated
GeneralRe: Wpf c# dynamicaly added canvas margin or top - right properties are always zero Pin
Pete O'Hanlon28-May-12 1:28
mvePete O'Hanlon28-May-12 1:28 
QuestionHELP!!!!! Pin
Member 903064525-May-12 12:44
Member 903064525-May-12 12:44 
SuggestionRe: HELP!!!!! Pin
AspDotNetDev25-May-12 13:15
protectorAspDotNetDev25-May-12 13:15 
GeneralRe: HELP!!!!! Pin
AmitGajjar27-May-12 22:03
professionalAmitGajjar27-May-12 22:03 
AnswerRe: HELP!!!!! Pin
Richard Andrew x6425-May-12 13:18
professionalRichard Andrew x6425-May-12 13:18 
AnswerRe: HELP!!!!! Pin
jschell26-May-12 7:18
jschell26-May-12 7:18 
QuestionSend email Pin
sina rahimzadeh25-May-12 8:20
sina rahimzadeh25-May-12 8:20 
AnswerRe: Send email Pin
PIEBALDconsult25-May-12 8:46
mvePIEBALDconsult25-May-12 8:46 
AnswerRe: Send email Pin
AmitGajjar27-May-12 20:52
professionalAmitGajjar27-May-12 20:52 
QuestionAlternative to Application.StartupPath Pin
MichCl25-May-12 4:26
MichCl25-May-12 4:26 
AnswerRe: Alternative to Application.StartupPath Pin
Eddy Vluggen25-May-12 4:57
professionalEddy Vluggen25-May-12 4:57 
GeneralRe: Alternative to Application.StartupPath Pin
BobJanova25-May-12 5:51
BobJanova25-May-12 5:51 
GeneralRe: Alternative to Application.StartupPath Pin
Eddy Vluggen25-May-12 6:15
professionalEddy Vluggen25-May-12 6:15 
AnswerRe: Alternative to Application.StartupPath Pin
Richard MacCutchan25-May-12 4:58
mveRichard MacCutchan25-May-12 4:58 
AnswerRe: Alternative to Application.StartupPath Pin
BobJanova25-May-12 5:52
BobJanova25-May-12 5:52 
GeneralRe: Alternative to Application.StartupPath Pin
Eddy Vluggen25-May-12 6:18
professionalEddy Vluggen25-May-12 6:18 
GeneralRe: Alternative to Application.StartupPath Pin
BobJanova25-May-12 6:27
BobJanova25-May-12 6:27 

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.