Click here to Skip to main content
15,903,175 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: MdiChild Pin
columbos149277-Nov-11 19:33
columbos149277-Nov-11 19:33 
GeneralRe: MdiChild Pin
Mark Salsbery8-Nov-11 5:19
Mark Salsbery8-Nov-11 5:19 
GeneralRe: MdiChild Pin
Pete O'Hanlon8-Nov-11 6:01
mvePete O'Hanlon8-Nov-11 6:01 
QuestionHow to add a link to textblock inside an ItemsControl? Pin
rams26-Nov-11 7:21
rams26-Nov-11 7:21 
AnswerRe: How to add a link to textblock inside an ItemsControl? Pin
Mark Salsbery6-Nov-11 8:18
Mark Salsbery6-Nov-11 8:18 
GeneralRe: How to add a link to textblock inside an ItemsControl? Pin
rams26-Nov-11 18:13
rams26-Nov-11 18:13 
GeneralRe: How to add a link to textblock inside an ItemsControl? Pin
SledgeHammer017-Nov-11 6:59
SledgeHammer017-Nov-11 6:59 
QuestionActualWidth value is becoming 0 Pin
indian1436-Nov-11 6:46
indian1436-Nov-11 6:46 
Hi All,

I have following code in silverlight, I want to set max width for the StackPanel dynamically in xaml, but its not showing anything, means the width or max width value it is getting is "0". Basically I want to set the maxwidth of xaml to wrap the text inside the textblock

Foloowing is the Silverlight user control xaml:

<UserControl x:Class="TextBlockLayoutTest.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:converters="clr-namespace:ConvertersSilverlightClassLibrary;assembly=ConvertersSilverlightClassLibrary"
    mc:Ignorable="d" x:Name="testUC">
    <UserControl.Resources>
        <converters:PercentageConverter x:Key="PercentageConverter"/>
    </UserControl.Resources>    
    <Grid x:Name="grid">
        <Grid.ColumnDefinitions>
            <ColumnDefinition x:Name="gridCol1" Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />            
        </Grid.RowDefinitions>
        <StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="0" 
                    MaxWidth="{Binding ElementName=grid, Path=ActualWidth}">       
            <TextBlock TextWrapping="Wrap" >
                test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
            </TextBlock>        
        </StackPanel>
    </Grid>
</UserControl>


public class PercentageConverter : IValueConverter 
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
        {
            double d = System.Convert.ToDouble(value);
            d = System.Convert.ToDouble(parameter);
            return System.Convert.ToDouble(value) * System.Convert.ToDouble(parameter); 
            //return 200;
        }      
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 
        { 
            throw new NotImplementedException(); 
        } 
}



I tried to do the same using converters too, I binded my TextBlock width property with this PercentageConverter class still, the convert method is returning 0 so the textblock is becoming invisible. I tried in all the ways to wrap the text in side the textblock and show it accordning to the maxwidth of stack panel. In anyways its not becoming possible to wrap the text. We are implementing MVVM and Prism so we dont to implement code behind.

Can anybody please help me achieving this without using the code behind.

Thanks in advance.
Thanks & Regards,

Abdul Aleem Mohammad
St Louis MO - USA

AnswerRe: ActualWidth value is becoming 0 Pin
Mark Salsbery6-Nov-11 8:36
Mark Salsbery6-Nov-11 8:36 
AnswerRe: ActualWidth value is becoming 0 Pin
SledgeHammer017-Nov-11 6:52
SledgeHammer017-Nov-11 6:52 
GeneralRe: ActualWidth value is becoming 0 Pin
indian1438-Nov-11 14:57
indian1438-Nov-11 14:57 
QuestionKeep messagebox on top of window [Solved] Pin
WelshChris4-Nov-11 4:07
WelshChris4-Nov-11 4:07 
AnswerRe: Keep messagebox on top of window Pin
Wayne Gaylard4-Nov-11 4:14
professionalWayne Gaylard4-Nov-11 4:14 
GeneralRe: Keep messagebox on top of window Pin
WelshChris4-Nov-11 4:21
WelshChris4-Nov-11 4:21 
GeneralRe: Keep messagebox on top of window Pin
Wayne Gaylard4-Nov-11 4:29
professionalWayne Gaylard4-Nov-11 4:29 
GeneralRe: Keep messagebox on top of window Pin
WelshChris4-Nov-11 6:54
WelshChris4-Nov-11 6:54 
GeneralRe: Keep messagebox on top of window Pin
SledgeHammer014-Nov-11 7:15
SledgeHammer014-Nov-11 7:15 
GeneralRe: Keep messagebox on top of window Pin
WelshChris4-Nov-11 7:29
WelshChris4-Nov-11 7:29 
GeneralRe: Keep messagebox on top of window Pin
Wayne Gaylard4-Nov-11 8:11
professionalWayne Gaylard4-Nov-11 8:11 
QuestionWPF Pin
Unque4-Nov-11 3:06
Unque4-Nov-11 3:06 
AnswerRe: WPF Pin
Abhinav S4-Nov-11 3:15
Abhinav S4-Nov-11 3:15 
QuestionWPF Editable ComboBox In GridView Pin
Kevin Marois3-Nov-11 13:18
professionalKevin Marois3-Nov-11 13:18 
AnswerRe: WPF Editable ComboBox In GridView Pin
SledgeHammer013-Nov-11 16:13
SledgeHammer013-Nov-11 16:13 
GeneralRe: WPF Editable ComboBox In GridView Pin
Kevin Marois4-Nov-11 7:57
professionalKevin Marois4-Nov-11 7:57 
GeneralRe: WPF Editable ComboBox In GridView Pin
SledgeHammer014-Nov-11 8:14
SledgeHammer014-Nov-11 8:14 

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.