Click here to Skip to main content
15,890,185 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionsearch users in AD based on attribute Pin
byka7-Nov-11 2:06
byka7-Nov-11 2:06 
Questionlinq with web form Pin
Member 82175176-Nov-11 6:32
Member 82175176-Nov-11 6:32 
Questionhow to perform search & show result on searchresult.aspx page Pin
bilawal shah6-Nov-11 4:28
bilawal shah6-Nov-11 4:28 
AnswerRe: how to perform search & show result on searchresult.aspx page Pin
thatraja6-Nov-11 6:12
professionalthatraja6-Nov-11 6:12 
Generalcreate a blog service like blogger.com Pin
rebvar5-Nov-11 22:33
rebvar5-Nov-11 22:33 
GeneralRe: create a blog service like blogger.com Pin
Bernhard Hiller6-Nov-11 19:32
Bernhard Hiller6-Nov-11 19:32 
GeneralRe: create a blog service like blogger.com Pin
MaulikDusara9-Nov-11 17:59
MaulikDusara9-Nov-11 17:59 
QuestionMaxWidth for the StackPanel Pin
indian1435-Nov-11 19:56
indian1435-Nov-11 19:56 
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: MaxWidth for the StackPanel Pin
thatraja6-Nov-11 6:21
professionalthatraja6-Nov-11 6:21 
Questiondatacontext object with webform control Pin
classy_dog5-Nov-11 13:13
classy_dog5-Nov-11 13:13 
Questionembed datarouce in web form 2010 control Pin
classy_dog5-Nov-11 13:11
classy_dog5-Nov-11 13:11 
Questionrestricting user access based on type of user Pin
SIMOKOOL5-Nov-11 8:11
SIMOKOOL5-Nov-11 8:11 
AnswerRe: restricting user access based on type of user Pin
Mark Salsbery5-Nov-11 9:48
Mark Salsbery5-Nov-11 9:48 
AnswerRe: restricting user access based on type of user Pin
Wonde Tadesse5-Nov-11 10:42
professionalWonde Tadesse5-Nov-11 10:42 
AnswerRe: restricting user access based on type of user Pin
MaulikDusara9-Nov-11 18:07
MaulikDusara9-Nov-11 18:07 
Questionhi friends Pin
xgow4-Nov-11 20:11
xgow4-Nov-11 20:11 
AnswerRe: hi friends Pin
purnananda behera7-Nov-11 19:03
purnananda behera7-Nov-11 19:03 
Questionbuttons on asp.net 2010 controls Pin
classy_dog4-Nov-11 4:43
classy_dog4-Nov-11 4:43 
AnswerRe: buttons on asp.net 2010 controls Pin
Hanzaplast5-Nov-11 3:35
Hanzaplast5-Nov-11 3:35 
GeneralRe: buttons on asp.net 2010 controls Pin
classy_dog5-Nov-11 13:20
classy_dog5-Nov-11 13:20 
Questionhow to insert an image dynamically into a table Pin
rahul honey4-Nov-11 1:43
rahul honey4-Nov-11 1:43 
AnswerRe: how to insert an image dynamically into a table Pin
Rocky#4-Nov-11 2:41
Rocky#4-Nov-11 2:41 
GeneralRe: how to insert an image dynamically into a table Pin
rahul honey4-Nov-11 2:50
rahul honey4-Nov-11 2:50 
Questionhi friends Pin
xgow3-Nov-11 21:24
xgow3-Nov-11 21:24 
AnswerRe: hi friends Pin
Anurag Gandhi3-Nov-11 22:34
professionalAnurag Gandhi3-Nov-11 22:34 

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.