我想在模板中获取绝对URL.我无法使用网址.它给了我一个相对的URL.我需要得到这个:
http://domain.tld/article/post
Run Code Online (Sandbox Code Playgroud)
但是Django只给了我
/article/post
Run Code Online (Sandbox Code Playgroud)
我玩settings.py但它没有用.(debug = false,允许主机与)
模板代码:
{% url 'blog:detail' blog.slug %}
Run Code Online (Sandbox Code Playgroud) 我在FXML文档中设计了一个表单.我可以处理按键与事件.但我需要文本更改事件.我正在使用Netbeans 7.3.项目中有三个文件:SampleControler,Sample.FXML和Sample.java.我找到了一个代码,但我还没有解决使用它的问题.
input.textProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue ov, String t, String t1) {
System.out.println("Changed.");
}
});
Run Code Online (Sandbox Code Playgroud)
我的TextArea代码是:
<TextArea layoutX="10" layoutY="50" maxHeight="125" minHeight="125" maxWidth="570" minWidth="570" editable="true" fx:id="input" prefWidth="570" prefHeight="125" />
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
我试图在 Image.Source 中显示我的矢量图像XamlReader。我有一个这样的 XAML 资源。
<Canvas Width="76" Height="76" ClipToBounds="True" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Path Fill="#FF000000" Height="76" Stretch="Fill" Width="76">
<Path.Data>
<PathGeometry FillRule="Nonzero" Figures="M21,30.0001L55.9999,30.0001 55.9999,50 21,50 21,30.0001z M52,28L37,28C38,25,39.4999,24.0001,39.4999,24.0001L50.75,24C51.3023,24,52,24.6977,52,25.25L52,28z" />
</Path.Data>
</Path>
Run Code Online (Sandbox Code Playgroud)
从这里创建了一个绑定。但是当我尝试使用它时它不起作用:
<Image Stretch="Fill" Source="{Binding Converter={StaticResource uriToUIElementConverter},ConverterParameter=images/Folder.xaml}"/>
Run Code Online (Sandbox Code Playgroud)
文件的属性Build Action=Resource。转换器uriTOUIElementConverter是这样的:
public class FileToUIElementConverter :IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
FileStream fileStream = new FileStream((string)parameter, FileMode.Open);
return XamlReader.Load(fileStream) as DrawingImage;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) …Run Code Online (Sandbox Code Playgroud)