Jump to content
xisto Community

xarzu

Members
  • Content Count

    6
  • Joined

  • Last visited

  1. In a silverlight app, I have a BitmapImage defined as System.Windows.Media.Imaging.BitmapImage and it as a method called "SetSource" where I can set the source like this: BitmapImage bitmap = new BitmapImage(); System.IO.Stream stream = _scene.GetStream(); if (stream == null) return; bitmap.SetSource(stream); In a WPF application I have also have a Bitmap image defined as System.Windows.Media.Imaging.BitmapImage but there is no SetSource method. How do I set the source in a WPF app like I do in a Silverlight app? Also, it is a stream, not a string. It is not a URI. so "UriSource" method does not work. I tried this: System.IO.Stream stream = _scene.GetStream(); if (stream == null) return; BitmapImage bitmap = new BitmapImage(); bitmap.UriSource = new Uri(stream.ToString()); And at runtime, it threw an error tha URI cannot be determined. Is the URI an identifier for the intranet? Are you sure that this is not a silverlight thing? I am doing a WPF application
  2. How do you set a default size of a control that you can resize? I have been looking at a code sample from Charles Petzold. It is from here: http://forums.xisto.com/no_longer_exists/ it uses mouse over methods to increase the size of button classes. I have it working but I want to make some modifications. I want the starting size of the button to be larger. I do not know how much of the code I need to post here to make the issue clear enough. The XAML for the page describes a "FisheyeButton" that is described in a seperate xaml file. Something like this: <StackPanel x:Name="LayoutRoot" Width="1017" Orientation="Horizontal" Height="253"> <src:FisheyeButton Style="{StaticResource btnStyle}" ButtonContent="Button No. 1" /> </StackPanel> The functionality of the project is such that if I give the Fisheyebutton a width and height a set size at this loction, the effect where the size of the control the effect of becoming larger does not happen. In other words, if I write in the <src:FisheyeButton... tag above Width="100", then the button does not behave at run time as it should. In the same page.xaml file, the btnStyle is defined like this: <UserControl.Resources > <Style x:Key="btnStyle" TargetType="src:FisheyeButton"> <Setter Property="VerticalAlignment" Value ="Center" /> <Setter Property="HorizontalAlignment" Value ="Center" /> <Setter Property="FontSize" Value ="12" /> </Style ></UserControl.Resources >I wonder if perhaps at this point, I can add a "Setter" property to define a default starting widh and height for the class. The animation, what makes the custom button class grow larger and also return to a normal size, is done in a seperate XAML for the Fisheyebutton class: <UserControl x:Class="FisheyeButtons6.FisheyeButton" xmlns="[url="http://forums.xisto.com/no_longer_exists/; xmlns:x="[url="http://forums.xisto.com/no_longer_exists/; xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" xmlns:src="clr-namespace:FisheyeButtons6" mc:Ignorable="d" xmlns:d="[url="http://forums.xisto.com/no_longer_exists/; xmlns:mc="[url="http://forums.xisto.com/no_longer_exists/; d:DesignHeight="64" d:DesignWidth="146"> <Grid x:Name="LayoutRoot" Background="White" > <vsm:VisualStateManager.VisualStateGroups> <vsm:VisualStateGroup x:Name="CommonStates"> <vsm:VisualState x:Name="Normal"> <Storyboard> <DoubleAnimation Storyboard.TargetName="presenter" Storyboard.TargetProperty="ScaleX" To="1" Duration="0:0:0.25" /> <DoubleAnimation Storyboard.TargetName="presenter" Storyboard.TargetProperty="ScaleY" To="1" Duration="0:0:0.25" /> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="MouseOver"> <Storyboard> <DoubleAnimation Storyboard.TargetName="presenter" Storyboard.TargetProperty="ScaleX" To="3" Duration="0:0:1" /> <DoubleAnimation Storyboard.TargetName="presenter" Storyboard.TargetProperty="ScaleY" To="3" Duration="0:0:1" /> </Storyboard> </vsm:VisualState> </vsm:VisualStateGroup> </vsm:VisualStateManager.VisualStateGroups> <Button> <src:ScalableContentPresenter x:Name="presenter" /> </Button> </Grid></UserControl>
  3. Help me Convert this WPF to Silverlight I am interested in a Charles Petzold C# example that shows how to do a fisheye effect ( http://forums.xisto.com/no_longer_exists/ ). The XAML code samples are in WPF but I want to try this in Silverlight. When I try to create the XAML code in Silverlight, the compiler complains in two locations: <Style TargetType="{x:Type Button}"> Error 1 The type 'x:Type' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. <Style.Triggers> Error 2 The attachable property 'Triggers' was not found in type 'Style'.How do I convert this to Silverlight?
  4. TextBlock wrapping of text in Silverlight XAML file.I have a wierd and annoying problem. I have a textblock that is inside a stackpanel that is Oriented horizontal. It would be nice if I could have the textblock appear in multiple lines nicely wrapped. How could I do that?
  5. When editing an XAML file using visual studio 2010 sometimes the tick marks to colapse groups are there and sometimes they are not. Can anyone tell me why?
  6. I am used to C++ more than C#.In C++ you have header files and you have the ability to declare states. For example, you can declare a series of unsigned integers to be for a variety of different states to later use in switch statements or if-then statements.Since C# does not have the same sort of structure with header files, how would I impliment a simular functionality in C#?The reason why I want to use UINT is because you can do that super cool bit-wise and and or with them. Remember those good ol' days? You could define four different conditions like this:UINT state_001 2UINT state_002 4UINT state_003 8UINT state_004 16Then a variable can be any one state or any combination of states. To assign a variable a particular state, you do a bitwise and to the variable. To see if the variable was set to any of the states, you do a bitwise or.How would that look like in Visual C#?
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.